Support updating the host environment in skylab.
BUG=chromium:832309
TEST="atest host mod --skylab"
CQ-DEPEND=CL:1093457
Change-Id: Ibde83af8dfbb47b878e418cbb38c051bb7437315
Reviewed-on: https://chromium-review.googlesource.com/1093535
Reviewed-by: Xixuan Wu <xixuan@chromium.org>
Tested-by: Ningning Xia <nxia@chromium.org>
diff --git a/cli/host.py b/cli/host.py
index c49e1f3..af47976 100644
--- a/cli/host.py
+++ b/cli/host.py
@@ -614,6 +614,13 @@
action='store_true')
self.add_skylab_options()
+ self.parser.add_option('--new-env',
+ dest='new_env',
+ choices=['staging', 'prod'],
+ help=('The new environment ("staging" or '
+ '"prod") of the hosts. %s' %
+ skylab_utils.MSG_ONLY_VALID_IN_SKYLAB),
+ default=None)
def _parse_unlock_options(self, options):
@@ -645,6 +652,7 @@
self.remove_acls = options.remove_acls
self.remove_labels = options.remove_labels
+ self.new_env = options.new_env
return (options, leftover)
@@ -678,7 +686,8 @@
unlock_lock_id=self.unlock_lock_id,
attributes=self.attributes,
remove_labels=self.remove_labels,
- label_map=self.label_map)
+ label_map=self.label_map,
+ new_env=self.new_env)
successes.append(hostname)
except device.SkylabDeviceActionError as e:
print('Cannot modify host %s: %s' % (hostname, e))