From 544e3070a3287a10495ca15cfc76489cab155887 Mon Sep 17 00:00:00 2001 From: miaohb Date: Mon, 7 Nov 2016 14:32:01 +0800 Subject: [PATCH] cluster policy attach cannot work The value of parsed_args.enabled must be changed from string to bool Change-Id: Icf4fb6d93db269ebfe828d57736563d20a90686d Closed-Bug: 1639706 --- senlinclient/tests/unit/v1/test_cluster.py | 2 +- senlinclient/v1/cluster.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/senlinclient/tests/unit/v1/test_cluster.py b/senlinclient/tests/unit/v1/test_cluster.py index 4240d965..dcb42333 100644 --- a/senlinclient/tests/unit/v1/test_cluster.py +++ b/senlinclient/tests/unit/v1/test_cluster.py @@ -599,7 +599,7 @@ class TestClusterPolicyAttach(TestCluster): self.mock_client.cluster_attach_policy.assert_called_with( 'my_cluster', 'my_policy', - enabled='True') + enabled=True) class TestClusterPolicyDetach(TestCluster): diff --git a/senlinclient/v1/cluster.py b/senlinclient/v1/cluster.py index b2b4bd98..07992c6c 100644 --- a/senlinclient/v1/cluster.py +++ b/senlinclient/v1/cluster.py @@ -22,6 +22,7 @@ from openstack import exceptions as sdk_exc from osc_lib.command import command from osc_lib import exceptions as exc from osc_lib import utils +from oslo_utils import strutils import six from senlinclient.common.i18n import _ @@ -545,7 +546,8 @@ class ClusterPolicyAttach(command.Command): senlin_client = self.app.client_manager.clustering kwargs = { - 'enabled': parsed_args.enabled, + 'enabled': strutils.bool_from_string(parsed_args.enabled, + strict=True), } resp = senlin_client.cluster_attach_policy(parsed_args.cluster,