~mvo/ubuntu/vivid/ubuntu-core-upgrader/chainsaw-removal

« back to all changes in this revision

Viewing changes to bin/ubuntu-core-upgrade

  • Committer: Package Import Robot
  • Author(s): James Hunt
  • Date: 2014-11-03 14:03:29 UTC
  • Revision ID: package-import@ubuntu.com-20141103140329-cop0mazbe12b5kqx
Tags: 0.3
* Added '--no-reboot' and '--reboot-delay' options.
* ubuntucoreupgrader/parser.py:
  - tar_generator():
    - Reworked to make logic clearer.
    - Only ignore devices if they already exist.
  - _update():
    - Strip expected file prefix rather than just blindly removing first
      element.
    - Ignore relative paths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
# process of being applied.
44
44
IN_PROGRESS_SUFFIX = 'applying'
45
45
 
 
46
# seconds to wait before a reboot (should one be required)
 
47
DEFAULT_REBOOT_DELAY = 2
 
48
 
46
49
log = logging.getLogger()
47
50
 
48
51
 
107
110
    parser = argparse.ArgumentParser(description='System image Upgrader')
108
111
 
109
112
    parser.add_argument(
110
 
        '--debug',
111
 
        nargs='?', const=1, default=0, type=int,
112
 
        help='Dump debug info (specify numeric value to increase verbosity)')
113
 
 
114
 
    parser.add_argument(
115
 
        '--leave-files',
116
 
        action='store_true',
117
 
        help='Do not remove the downloaded system image files after upgrade')
118
 
 
119
 
    parser.add_argument(
120
113
        '--check-reboot',
121
114
        action='store_true',
122
115
        help='''
130
123
        ''')
131
124
 
132
125
    parser.add_argument(
 
126
        '--debug',
 
127
        nargs='?', const=1, default=0, type=int,
 
128
        help='Dump debug info (specify numeric value to increase verbosity)')
 
129
 
 
130
    parser.add_argument(
133
131
        '-n', '--dry-run',
134
132
        action='store_true',
135
133
        help='''
138
136
        ''')
139
137
 
140
138
    parser.add_argument(
 
139
        '--leave-files',
 
140
        action='store_true',
 
141
        help='Do not remove the downloaded system image files after upgrade')
 
142
 
 
143
    parser.add_argument(
 
144
        '--no-reboot',
 
145
        action='store_true',
 
146
        help='Do not reboot even if one would normally be required')
 
147
 
 
148
    parser.add_argument(
 
149
        '--reboot-delay',
 
150
        type=int, default=DEFAULT_REBOOT_DELAY,
 
151
        help='''
 
152
        Wait for specified number of seconds before rebooting
 
153
        (default={})
 
154
        '''.format(DEFAULT_REBOOT_DELAY))
 
155
 
 
156
    parser.add_argument(
141
157
        '-t', '--tmpdir',
142
158
        help='Specify name for pre-existing temporary directory to use')
143
159
 
147
163
 
148
164
    options = parser.parse_args()
149
165
 
 
166
    if options.reboot_delay < 0:
 
167
        sys.exit('ERROR: must specify a positive number')
 
168
 
150
169
    if options.check_reboot:
151
170
        # check options must be inert
152
171
        options.dry_run = True