diff options
Diffstat (limited to 'cli')
-rwxr-xr-x | cli/host.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/cli/host.py b/cli/host.py index c8246126..e5c98585 100755 --- a/cli/host.py +++ b/cli/host.py @@ -23,6 +23,7 @@ See topic_common.py for a High Level Design and Algorithm. import os, sys, socket from autotest_lib.cli import topic_common, action_common +from autotest_lib.client.common_lib import host_protections class host(topic_common.atest): @@ -32,6 +33,8 @@ class host(topic_common.atest): topic = msg_topic = 'host' msg_items = '<hosts>' + protections = host_protections.Protection.names + def __init__(self): """Add to the parser the options common to all the @@ -327,13 +330,11 @@ class host_mod(host): help='Unlock hosts', action='store_true') self.parser.add_option('-p', '--protection', type='choice', - help='Set the protection level on a host. ' - 'Must be one of: "No protection", ' - '"Software repair only", ' - '"Repair filesystem only", or "Do not repair"', - choices=('No protection', 'Repair software only', - 'Repair filesystem only', - 'Do not repair')) + help=('Set the protection level on a host. ' + 'Must be one of: %s' % + ', '.join('"%s"' % p + for p in self.protections)), + choices=self.protections) def parse(self): @@ -380,6 +381,7 @@ class host_create(host): """atest host create [--lock|--unlock --platform <arch> --labels <labels>|--blist <label_file> --acls <acls>|--alist <acl_file> + --protection <protection_type> --mlist <mach_file>] <hosts>""" usage_action = 'create' @@ -407,6 +409,12 @@ class host_create(host): help='File listing the acls', type='string', metavar='ACL_FLIST') + self.parser.add_option('-p', '--protection', type='choice', + help=('Set the protection level on a host. ' + 'Must be one of: %s' % + ', '.join('"%s"' % p + for p in self.protections)), + choices=self.protections) def parse(self): @@ -417,6 +425,8 @@ class host_create(host): self._parse_lock_options(options) self.locked = options.lock self.platform = getattr(options, 'platform', None) + if options.protection: + self.data['protection'] = options.protection return (options, leftover) |