Policy binding attach cannot work

The value of args.enabled must be changed from string to bool

Closed-Bug: 1639692

Change-Id: I657eeeb44a14f484aef7cc52157876c7daf653c8
This commit is contained in:
miaohb
2016-11-07 12:55:42 +08:00
parent e79cdb3060
commit 2cf0d9fbc6
2 changed files with 6 additions and 5 deletions

View File

@@ -1260,11 +1260,11 @@ class ShellTest(testtools.TestCase):
args = {
'id': 'C1',
'policy': 'P1',
'enabled': 'True',
'enabled': True,
}
args = self._make_args(args)
kwargs = {
'enabled': 'True',
'enabled': True,
}
service.cluster_attach_policy.return_value = {'action': 'action_id'}
sh.do_cluster_policy_attach(service, args)
@@ -1288,11 +1288,11 @@ class ShellTest(testtools.TestCase):
args = {
'id': 'C1',
'policy': 'policy1',
'enabled': 'True',
'enabled': True,
}
args = self._make_args(args)
kwargs = {
'enabled': 'True',
'enabled': True,
}
service.cluster_update_policy.return_value = {'action': 'action_id'}

View File

@@ -16,6 +16,7 @@ import threading
import time
from openstack import exceptions as sdk_exc
from oslo_utils import strutils
import six
from senlinclient.common import exc
@@ -1052,7 +1053,7 @@ def do_cluster_policy_update(service, args):
show_deprecated('senlin cluster-policy-update',
'openstack cluster policy binding update')
kwargs = {
'enabled': args.enabled,
'enabled': strutils.bool_from_string(args.enabled, strict=True),
}
resp = service.cluster_update_policy(args.id, args.policy, **kwargs)