Merge "Fix senlin resources update failure"
This commit is contained in:
commit
e5238e4035
@ -213,7 +213,8 @@ class Cluster(resource.Resource):
|
|||||||
**params)
|
**params)
|
||||||
return resp['action']
|
return resp['action']
|
||||||
elif action == 'cluster_update':
|
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)
|
**params)
|
||||||
return resp.location.split('/')[-1]
|
return resp.location.split('/')[-1]
|
||||||
|
|
||||||
|
@ -124,8 +124,9 @@ class Node(resource.Resource):
|
|||||||
if prop_diff:
|
if prop_diff:
|
||||||
if self.PROFILE in prop_diff:
|
if self.PROFILE in prop_diff:
|
||||||
prop_diff['profile_id'] = prop_diff.pop(self.PROFILE)
|
prop_diff['profile_id'] = prop_diff.pop(self.PROFILE)
|
||||||
|
node_obj = self.client().get_node(self.resource_id)
|
||||||
node = self.client().update_node(
|
node = self.client().update_node(
|
||||||
self.resource_id, **prop_diff)
|
node_obj, **prop_diff)
|
||||||
action_id = node.location.split('/')[-1]
|
action_id = node.location.split('/')[-1]
|
||||||
|
|
||||||
return action_id
|
return action_id
|
||||||
|
@ -175,7 +175,8 @@ class Policy(resource.Resource):
|
|||||||
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
||||||
if self.NAME in prop_diff:
|
if self.NAME in prop_diff:
|
||||||
param = {'name': prop_diff[self.NAME]}
|
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()
|
actions = dict()
|
||||||
if self.BINDINGS in prop_diff:
|
if self.BINDINGS in prop_diff:
|
||||||
old = self.properties[self.BINDINGS] or []
|
old = self.properties[self.BINDINGS] or []
|
||||||
|
@ -83,7 +83,8 @@ class Profile(resource.Resource):
|
|||||||
|
|
||||||
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
||||||
if 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):
|
def _show_resource(self):
|
||||||
profile = self.client().get_profile(self.resource_id)
|
profile = self.client().get_profile(self.resource_id)
|
||||||
|
@ -171,7 +171,7 @@ class SenlinClusterTest(common.HeatTestCase):
|
|||||||
'name': 'new_name'
|
'name': 'new_name'
|
||||||
}
|
}
|
||||||
self.senlin_mock.update_cluster.assert_called_once_with(
|
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)
|
self.assertEqual(2, self.senlin_mock.get_action.call_count)
|
||||||
|
|
||||||
def test_cluster_update_desire_capacity(self):
|
def test_cluster_update_desire_capacity(self):
|
||||||
|
@ -150,7 +150,7 @@ class SenlinNodeTest(common.HeatTestCase):
|
|||||||
'name': 'new_name'
|
'name': 'new_name'
|
||||||
}
|
}
|
||||||
self.senlin_mock.update_node.assert_called_once_with(
|
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)
|
self.assertEqual(2, self.senlin_mock.get_action.call_count)
|
||||||
|
|
||||||
def test_node_update_failed(self):
|
def test_node_update_failed(self):
|
||||||
|
@ -164,10 +164,11 @@ class SenlinPolicyTest(common.HeatTestCase):
|
|||||||
'action': 'fake_action1'}
|
'action': 'fake_action1'}
|
||||||
self.senlin_mock.cluster_detach_policy.return_value = {
|
self.senlin_mock.cluster_detach_policy.return_value = {
|
||||||
'action': 'fake_action2'}
|
'action': 'fake_action2'}
|
||||||
|
self.senlin_mock.get_policy.return_value = self.fake_p
|
||||||
scheduler.TaskRunner(policy.update, new_cluster)()
|
scheduler.TaskRunner(policy.update, new_cluster)()
|
||||||
self.assertEqual((policy.UPDATE, policy.COMPLETE), policy.state)
|
self.assertEqual((policy.UPDATE, policy.COMPLETE), policy.state)
|
||||||
self.senlin_mock.update_policy.assert_called_once_with(
|
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(
|
self.senlin_mock.cluster_detach_policy.assert_called_once_with(
|
||||||
'c1', policy.resource_id)
|
'c1', policy.resource_id)
|
||||||
self.senlin_mock.cluster_attach_policy.assert_called_with(
|
self.senlin_mock.cluster_attach_policy.assert_called_with(
|
||||||
|
@ -108,8 +108,9 @@ class SenlinProfileTest(common.HeatTestCase):
|
|||||||
def test_profile_update(self):
|
def test_profile_update(self):
|
||||||
profile = self._create_profile(self.t)
|
profile = self._create_profile(self.t)
|
||||||
prop_diff = {'metadata': {'foo': 'bar'}}
|
prop_diff = {'metadata': {'foo': 'bar'}}
|
||||||
|
self.senlin_mock.get_profile.return_value = self.fake_p
|
||||||
profile.handle_update(json_snippet=None,
|
profile.handle_update(json_snippet=None,
|
||||||
tmpl_diff=None,
|
tmpl_diff=None,
|
||||||
prop_diff=prop_diff)
|
prop_diff=prop_diff)
|
||||||
self.senlin_mock.update_profile.assert_called_once_with(
|
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