Fix resource update issues

Currently when updating a resource, the 'id' is not allowed to be
in the request body, openstacksdk is can not checking whether 'ID'
is legal or not. So pass an object to openstacksdk to get through.

Change-Id: I3b52ef9ceaa75ab28c3bb52a314b044fa51e6dda
This commit is contained in:
xu-haiwei 2016-12-01 06:28:39 +00:00
parent ff369bd963
commit e01394344f
2 changed files with 8 additions and 8 deletions

View File

@ -262,7 +262,7 @@ class ShellTest(testtools.TestCase):
'name': 'stack_spec',
'metadata': {'user': 'demo'},
}
service.update_profile.assert_called_once_with(profile_id, **params)
service.update_profile.assert_called_once_with(profile, **params)
mock_show.assert_called_once_with(service, profile_id)
@mock.patch.object(utils, 'format_parameters')
@ -662,7 +662,7 @@ class ShellTest(testtools.TestCase):
sh.do_policy_update(service, args)
service.get_policy.assert_called_once_with('policy_id')
service.update_policy.assert_called_once_with(
'policy_id', **params)
policy, **params)
mock_show(service, policy_id=policy.id)
def test_do_policy_delete(self):
@ -972,7 +972,7 @@ class ShellTest(testtools.TestCase):
sh.do_cluster_update(service, args)
service.get_cluster.assert_called_once_with('CID')
service.update_cluster.assert_called_once_with('CID', **attrs)
service.update_cluster.assert_called_once_with(cluster, **attrs)
mock_show.assert_called_once_with(service, 'CID')
@mock.patch.object(sh, '_show_cluster')
@ -1537,7 +1537,7 @@ class ShellTest(testtools.TestCase):
service.get_node.return_value = node
sh.do_node_update(service, args)
service.get_node.assert_called_once_with('node_id')
service.update_node.assert_called_once_with('node_id', **attrs)
service.update_node.assert_called_once_with(node, **attrs)
mock_show.assert_called_once_with(service, 'node_id')
@mock.patch.object(utils, 'print_list')

View File

@ -217,7 +217,7 @@ def do_profile_update(service, args):
profile = service.get_profile(args.id)
except sdk_exc.ResourceNotFound:
raise exc.CommandError(_('Profile not found: %s') % args.id)
service.update_profile(profile.id, **params)
service.update_profile(profile, **params)
_show_profile(service, profile.id)
@ -408,7 +408,7 @@ def do_policy_update(service, args):
policy = service.get_policy(args.id)
if policy is not None:
service.update_policy(policy.id, **params)
service.update_policy(policy, **params)
_show_policy(service, policy_id=policy.id)
@ -768,7 +768,7 @@ def do_cluster_update(service, args):
'timeout': args.timeout,
}
service.update_cluster(cluster.id, **attrs)
service.update_cluster(cluster, **attrs)
_show_cluster(service, cluster.id)
@ -1247,7 +1247,7 @@ def do_node_update(service, args):
'metadata': utils.format_parameters(args.metadata),
}
service.update_node(args.id, **attrs)
service.update_node(node, **attrs)
_show_node(service, node.id)