revise the "cluster-policy-attach"

The parameter "--enabled" in "cluster policy attach" is useless,
which can not be set to False.  Here we try to fix it so that
the parameter can be assigned to False when doing attach.

Change-Id: I0b5de3c6f61c38c62ac8c7e1b95d523175bbc11c
Closed-Bug: 1626833
This commit is contained in:
miaohb
2016-09-23 13:40:35 +08:00
parent 9448fb41d7
commit 6612e928f1
3 changed files with 4 additions and 4 deletions

View File

@@ -593,13 +593,13 @@ class TestClusterPolicyAttach(TestCluster):
return_value=self.response)
def test_cluster_policy_attach(self):
arglist = ['--policy', 'my_policy', '--enabled', 'my_cluster']
arglist = ['--policy', 'my_policy', '--enabled', 'True', 'my_cluster']
parsed_args = self.check_parser(self.cmd, arglist, [])
self.cmd.take_action(parsed_args)
self.mock_client.cluster_attach_policy.assert_called_with(
'my_cluster',
'my_policy',
enabled=True)
enabled='True')
class TestClusterPolicyDetach(TestCluster):

View File

@@ -522,8 +522,8 @@ class ClusterPolicyAttach(command.Command):
parser = super(ClusterPolicyAttach, self).get_parser(prog_name)
parser.add_argument(
'--enabled',
metavar='<enabled>',
default=True,
action="store_true",
help=_('Whether the policy should be enabled once attached. '
'Default to True')
)

View File

@@ -1012,7 +1012,7 @@ def do_cluster_policy_show(service, args):
@utils.arg('-p', '--policy', metavar='<POLICY>', required=True,
help=_('ID or name of policy to be attached.'))
@utils.arg('-e', '--enabled', default=True, action="store_true",
@utils.arg('-e', '--enabled', metavar='<enabled>', default=True,
help=_('Whether the policy should be enabled once attached. '
'Default to enabled.'))
@utils.arg('id', metavar='<NAME or ID>',