From 414ad237b633c39de3968d233f9d109a6c919d03 Mon Sep 17 00:00:00 2001 From: Haiwei Xu Date: Mon, 4 Jan 2016 11:56:24 +0900 Subject: [PATCH] Put 'policy' out of params for do_cluster_policy_attach In openstackSDK cluster_attach_policy method has 'cluster' and 'policy' parameters out of **params, so senlinclient should do the same thing for calling SDK. Change-Id: I18d3c499467daf371f64c2a883af7c710d16db87 Closes-bug: #1530751 --- senlinclient/tests/unit/v1/test_shell.py | 3 +-- senlinclient/v1/shell.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/senlinclient/tests/unit/v1/test_shell.py b/senlinclient/tests/unit/v1/test_shell.py index 08cd1ceb..f16b35ea 100644 --- a/senlinclient/tests/unit/v1/test_shell.py +++ b/senlinclient/tests/unit/v1/test_shell.py @@ -1014,7 +1014,6 @@ class ShellTest(testtools.TestCase): } args = self._make_args(args) kwargs = { - 'policy_id': 'policy1', 'priority': 50, 'level': 60, 'cooldown': 120, @@ -1024,7 +1023,7 @@ class ShellTest(testtools.TestCase): client.conn.cluster.cluster_attach_policy.return_value = resp sh.do_cluster_policy_attach(client, args) client.conn.cluster.cluster_attach_policy.assert_called_once_with( - 'cluster1', **kwargs) + 'cluster1', 'policy1', **kwargs) def test_do_cluster_policy_detach(self): args = { diff --git a/senlinclient/v1/shell.py b/senlinclient/v1/shell.py index 4cabfc72..df134b08 100644 --- a/senlinclient/v1/shell.py +++ b/senlinclient/v1/shell.py @@ -782,14 +782,14 @@ def do_cluster_policy_show(sc, args): def do_cluster_policy_attach(sc, args): """Attach policy to cluster.""" kwargs = { - 'policy_id': args.policy, 'priority': args.priority, 'level': args.enforcement_level, 'cooldown': args.cooldown, 'enabled': args.enabled, } - resp = sc.conn.cluster.cluster_attach_policy(args.id, **kwargs) + policy = args.policy + resp = sc.conn.cluster.cluster_attach_policy(args.id, policy, **kwargs) print('Request accepted by action: %s' % resp['action'])