diff options
author | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2009-03-17 19:06:18 +0000 |
---|---|---|
committer | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2009-03-17 19:06:18 +0000 |
commit | 5d86490e5c4a06624b0e54d03db75cda4ae8d04d (patch) | |
tree | 4aebfd053cfc3e7e1514850d259998f5d6d23e06 /cli | |
parent | 4b0dcb977c6f967bef6a85b5c3c343b0478610df (diff) |
Adding the protection flag to host create
Signed-off-by: Jean-Marc Eurin <jmeurin@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@2885 592f7852-d20e-0410-864c-8624ca9c26a4
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) |