Fix senlin resources update failure
Since senlinclient changed a little bit to call resource update, this patch correct the parameters to call senlin resource update. Change-Id: I24d00d07f2c4323c0bedd7272065ca872383536e Closes-Bug: #1653855
This commit is contained in:
parent
947eaac03f
commit
19632dbac0
@ -213,7 +213,8 @@ class Cluster(resource.Resource):
|
||||
**params)
|
||||
return resp['action']
|
||||
elif action == 'cluster_update':
|
||||
resp = self.client().update_cluster(self.resource_id,
|
||||
cluster_obj = self.client().get_cluster(self.resource_id)
|
||||
resp = self.client().update_cluster(cluster_obj,
|
||||
**params)
|
||||
return resp.location.split('/')[-1]
|
||||
|
||||
|
@ -124,8 +124,9 @@ class Node(resource.Resource):
|
||||
if prop_diff:
|
||||
if self.PROFILE in prop_diff:
|
||||
prop_diff['profile_id'] = prop_diff.pop(self.PROFILE)
|
||||
node_obj = self.client().get_node(self.resource_id)
|
||||
node = self.client().update_node(
|
||||
self.resource_id, **prop_diff)
|
||||
node_obj, **prop_diff)
|
||||
action_id = node.location.split('/')[-1]
|
||||
|
||||
return action_id
|
||||
|
@ -175,7 +175,8 @@ class Policy(resource.Resource):
|
||||
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
||||
if self.NAME in prop_diff:
|
||||
param = {'name': prop_diff[self.NAME]}
|
||||
self.client().update_policy(self.resource_id, **param)
|
||||
policy_obj = self.client().get_policy(self.resource_id)
|
||||
self.client().update_policy(policy_obj, **param)
|
||||
actions = dict()
|
||||
if self.BINDINGS in prop_diff:
|
||||
old = self.properties[self.BINDINGS] or []
|
||||
|
@ -83,7 +83,8 @@ class Profile(resource.Resource):
|
||||
|
||||
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
||||
if prop_diff:
|
||||
self.client().update_profile(self.resource_id, **prop_diff)
|
||||
profile_obj = self.client().get_profile(self.resource_id)
|
||||
self.client().update_profile(profile_obj, **prop_diff)
|
||||
|
||||
def _show_resource(self):
|
||||
profile = self.client().get_profile(self.resource_id)
|
||||
|
@ -171,7 +171,7 @@ class SenlinClusterTest(common.HeatTestCase):
|
||||
'name': 'new_name'
|
||||
}
|
||||
self.senlin_mock.update_cluster.assert_called_once_with(
|
||||
cluster.resource_id, **cluster_update_kwargs)
|
||||
self.fake_cl, **cluster_update_kwargs)
|
||||
self.assertEqual(2, self.senlin_mock.get_action.call_count)
|
||||
|
||||
def test_cluster_update_desire_capacity(self):
|
||||
|
@ -150,7 +150,7 @@ class SenlinNodeTest(common.HeatTestCase):
|
||||
'name': 'new_name'
|
||||
}
|
||||
self.senlin_mock.update_node.assert_called_once_with(
|
||||
node.resource_id, **node_update_kwargs)
|
||||
self.fake_node, **node_update_kwargs)
|
||||
self.assertEqual(2, self.senlin_mock.get_action.call_count)
|
||||
|
||||
def test_node_update_failed(self):
|
||||
|
@ -164,10 +164,11 @@ class SenlinPolicyTest(common.HeatTestCase):
|
||||
'action': 'fake_action1'}
|
||||
self.senlin_mock.cluster_detach_policy.return_value = {
|
||||
'action': 'fake_action2'}
|
||||
self.senlin_mock.get_policy.return_value = self.fake_p
|
||||
scheduler.TaskRunner(policy.update, new_cluster)()
|
||||
self.assertEqual((policy.UPDATE, policy.COMPLETE), policy.state)
|
||||
self.senlin_mock.update_policy.assert_called_once_with(
|
||||
policy.resource_id, name='new_name')
|
||||
self.fake_p, name='new_name')
|
||||
self.senlin_mock.cluster_detach_policy.assert_called_once_with(
|
||||
'c1', policy.resource_id)
|
||||
self.senlin_mock.cluster_attach_policy.assert_called_with(
|
||||
|
@ -108,8 +108,9 @@ class SenlinProfileTest(common.HeatTestCase):
|
||||
def test_profile_update(self):
|
||||
profile = self._create_profile(self.t)
|
||||
prop_diff = {'metadata': {'foo': 'bar'}}
|
||||
self.senlin_mock.get_profile.return_value = self.fake_p
|
||||
profile.handle_update(json_snippet=None,
|
||||
tmpl_diff=None,
|
||||
prop_diff=prop_diff)
|
||||
self.senlin_mock.update_profile.assert_called_once_with(
|
||||
profile.resource_id, **prop_diff)
|
||||
self.fake_p, **prop_diff)
|
||||
|
Loading…
Reference in New Issue
Block a user