From f8000686484c2928a82fbfe561e3d4efb92137c3 Mon Sep 17 00:00:00 2001 From: miaohb Date: Mon, 7 Nov 2016 12:43:05 +0800 Subject: [PATCH] policy binding update cannot work The value of args.enabled must change from string to bool Revise the related unit test Change-Id: Id297a26799ddad00221ef71f2e6c2f70b8e21ede Closed-Bug: 1639687 --- senlinclient/tests/unit/v1/test_shell.py | 4 ++-- senlinclient/v1/shell.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/senlinclient/tests/unit/v1/test_shell.py b/senlinclient/tests/unit/v1/test_shell.py index 1c2a197..b1ac18d 100644 --- a/senlinclient/tests/unit/v1/test_shell.py +++ b/senlinclient/tests/unit/v1/test_shell.py @@ -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'} diff --git a/senlinclient/v1/shell.py b/senlinclient/v1/shell.py index 742b66d..b28a036 100644 --- a/senlinclient/v1/shell.py +++ b/senlinclient/v1/shell.py @@ -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)