logging.info('Starting local devserver to get image path...')
try:
ds.Start()
- return ds.OpenURL(ds.GetDevServerURL(sub_dir=req), timeout=60 * 15)
+ return ds.OpenURL(ds.GetURL(sub_dir=req), timeout=60 * 15)
except ds_wrapper.DevServerResponseError as e:
logging.error('Unable to translate the image path: %s. Are you sure the '
except cros_build_lib.RunCommandError:
cmd_base = 'cat'
- cmd = '%s %s | dd of=%s bs=4M oflag=sync' % (cmd_base, image, device)
+ cmd = '%s %s | dd of=%s bs=4M iflag=fullblock oflag=sync' % (
+ cmd_base, image, device)
cros_build_lib.SudoRunCommand(cmd, shell=True)
cros_build_lib.SudoRunCommand(['sync'], debug_level=self.debug_level)
logging.info('Starting a local devserver to stage image...')
try:
ds.Start()
- url = ds.OpenURL(ds.GetDevServerURL(sub_dir=req), timeout=60 * 15)
+ url = ds.OpenURL(ds.GetURL(sub_dir=req), timeout=60 * 15)
except ds_wrapper.DevServerResponseError:
logging.warning('Could not download %s.', path)
def __init__(self, ssh_hostname, ssh_port, image, stateful_update=True,
rootfs_update=True, clobber_stateful=False, reboot=True,
board=None, src_image_to_delta=None, wipe=True, debug=False,
- yes=False):
+ yes=False, ping=True, disable_verification=False):
"""Initializes RemoteDeviceUpdater"""
if not stateful_update and not rootfs_update:
cros_build_lib.Die('No update operation to perform. Use -h to see usage.')
self.src_image_to_delta = src_image_to_delta
self.do_stateful_update = stateful_update
self.do_rootfs_update = rootfs_update
+ self.disable_verification = disable_verification
self.clobber_stateful = clobber_stateful
self.reboot = reboot
self.debug = debug
+ self.ping = ping
# Do not wipe if debug is set.
self.wipe = wipe and not debug
self.yes = yes
logging.info('Updating rootfs partition')
try:
ds.Start()
-
- omaha_url = ds.GetDevServerURL(ip=remote_access.LOCALHOST_IP,
- port=ds.port,
- sub_dir='update/pregenerated')
+ # Use the localhost IP address to ensure that update engine
+ # client can connect to the devserver.
+ omaha_url = ds.GetDevServerURL(
+ ip='127.0.0.1', port=ds.port, sub_dir='update/pregenerated')
cmd = [self.UPDATE_ENGINE_BIN, '-check_for_update',
'-omaha_url=%s' % omaha_url]
device.RunCommand(cmd)
raise
finally:
ds.Stop()
- device.CopyFromDevice(ds.log_filename,
+ device.CopyFromDevice(ds.log_file,
os.path.join(tempdir, 'target_devserver.log'),
error_code_ok=True)
device.CopyFromDevice('/var/log/update_engine.log', tempdir,
logging.info('Starting local devserver to generate/serve payloads...')
try:
ds.Start()
- url = ds.OpenURL(ds.GetDevServerURL(sub_dir=req), timeout=timeout)
+ url = ds.OpenURL(ds.GetURL(sub_dir=req), timeout=timeout)
ds.DownloadFile(os.path.join(url, self.ROOTFS_FILENAME), payload_dir)
ds.DownloadFile(os.path.join(url, self.STATEFUL_FILENAME), payload_dir)
except ds_wrapper.DevServerException:
logging.debug(ds.TailLog() or 'No devserver log is available.')
finally:
ds.Stop()
- if os.path.exists(ds.log_filename):
- shutil.copyfile(ds.log_filename,
+ if os.path.exists(ds.log_file):
+ shutil.copyfile(ds.log_file,
os.path.join(payload_dir, 'local_devserver.log'))
else:
- logging.warning('Could not find %s', ds.log_filename)
+ logging.warning('Could not find %s', ds.log_file)
def _CheckPayloads(self, payload_dir):
"""Checks that all update payloads exists in |payload_dir|."""
try:
with remote_access.ChromiumOSDeviceHandler(
self.ssh_hostname, port=self.ssh_port,
- base_dir=self.DEVICE_BASE_DIR) as device:
+ base_dir=self.DEVICE_BASE_DIR, ping=self.ping) as device:
board = cros_build_lib.GetBoard(device_board=device.board,
override_board=self.board,
device.BaseRunCommand(['mkdir', '-p', device.work_dir])
if self.do_rootfs_update and self.reboot:
+ logging.info('Verifying that the device has been updated...')
new_root_dev = self.GetRootDev(device)
self.Verify(old_root_dev, new_root_dev)
+ if self.disable_verification:
+ logging.info('Disabling rootfs verification on the device...')
+ device.DisableRootfsVerification()
+
except Exception:
logging.error('Device update failed.')
raise
update.add_argument(
'--clobber-stateful', action='store_true', default=False,
help='Clobber stateful partition when performing update.')
+ update.add_argument(
+ '--no-ping', dest='ping', action='store_false', default=True,
+ help='Do not ping the device before attempting to connect to it.')
+ update.add_argument(
+ '--disable-rootfs-verification', default=False, action='store_true',
+ help='Disable rootfs verification after update is completed.')
def __init__(self, options):
"""Initializes cros flash."""
reboot=self.options.reboot,
wipe=self.options.wipe,
debug=self.options.debug,
- yes=self.options.yes)
+ yes=self.options.yes,
+ ping=self.options.ping,
+ disable_verification=self.options.disable_rootfs_verification)
# Perform device update.
updater.Run()