From 598e881aea831fd09a8e4e1b3b8ca1c8058892aa Mon Sep 17 00:00:00 2001 From: Haiwei Xu Date: Wed, 2 Dec 2015 11:39:23 +0900 Subject: [PATCH] Fix profile update parameters passing error Currently profile udpate fails due to parameters passing problem. Change-Id: I1d31cd675b58ea1f941c6fd2486c7042739a9229 Closes-bug: #1521832 --- senlinclient/tests/unit/v1/test_shell.py | 3 +-- senlinclient/v1/client.py | 1 + senlinclient/v1/shell.py | 3 +-- 3 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 93021c85..8112465d 100644 --- a/senlinclient/tests/unit/v1/test_shell.py +++ b/senlinclient/tests/unit/v1/test_shell.py @@ -249,9 +249,8 @@ class ShellTest(testtools.TestCase): 'name': 'stack_spec', 'permission': 'ok', 'metadata': {'user': 'demo'}, - 'id': profile_id, } - client.update_profile.assert_called_once_with(params) + client.update_profile.assert_called_once_with(profile_id, **params) mock_show.assert_called_once_with(client, profile_id) # specified profile can't be found diff --git a/senlinclient/v1/client.py b/senlinclient/v1/client.py index 81409528..10ad8a52 100644 --- a/senlinclient/v1/client.py +++ b/senlinclient/v1/client.py @@ -56,6 +56,7 @@ class Client(object): return self.get(models.Profile, dict(id=value)) def update_profile(self, value, **attrs): + attrs['id'] = value return self.update(models.Profile, attrs) def delete_profile(self, value, ignore_missing=True): diff --git a/senlinclient/v1/shell.py b/senlinclient/v1/shell.py index 8f212975..77f64639 100644 --- a/senlinclient/v1/shell.py +++ b/senlinclient/v1/shell.py @@ -193,8 +193,7 @@ def do_profile_update(sc, args): except exc.HTTPNotFound: raise exc.CommandError(_('Profile not found: %s') % args.id) - params['id'] = profile.id - sc.update_profile(params) + sc.update_profile(profile.id, **params) _show_profile(sc, profile.id)