def __init__(self, hostname, port=None, username=None,
base_dir=DEFAULT_BASE_DIR, connect_settings=None,
- private_key=None, debug_level=logging.DEBUG):
+ private_key=None, debug_level=logging.DEBUG, ping=True):
"""Initializes a RemoteDevice object.
Args:
connect_settings: Default SSH connection settings.
private_key: The identify file to pass to `ssh -i`.
debug_level: Setting debug level for logging.
+ ping: Whether to ping the device before attempting to connect.
"""
self.hostname = hostname
self.port = port
# Setup a working directory on the device.
self.base_dir = base_dir
- if not self.Pingable():
+ if ping and not self.Pingable():
raise DeviceNotPingable('Device %s is not pingable.' % self.hostname)
# Do not call RunCommand here because we have not set up work directory yet.
return False
- def _DisableRootfsVerification(self):
+ def DisableRootfsVerification(self):
"""Disables device rootfs verification."""
logging.info('Disabling rootfs verification on device...')
self.RunCommand(
# If the image is built with rootfs verification, turn off the
# rootfs verification. After reboot, the rootfs will be mounted as
# read-write (there is no need to remount).
- self._DisableRootfsVerification()
+ self.DisableRootfsVerification()
return not self._RootfsIsReadOnly()