Merge "Don't get derived config if resource ID unset"
This commit is contained in:
commit
b1bd8a67d4
@ -435,10 +435,14 @@ class SoftwareDeployment(signal_responder.SignalResponder):
|
||||
return self._check_complete()
|
||||
|
||||
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
|
||||
prev_derived_config = self._get_derived_config_id()
|
||||
old_config = self._load_config(prev_derived_config)
|
||||
old_inputs = {i.name(): i
|
||||
for i in old_config[rpc_api.SOFTWARE_CONFIG_INPUTS]}
|
||||
if self.resource_id is None:
|
||||
prev_derived_config = None
|
||||
old_inputs = {}
|
||||
else:
|
||||
prev_derived_config = self._get_derived_config_id()
|
||||
old_config = self._load_config(prev_derived_config)
|
||||
old_inputs = {i.name(): i
|
||||
for i in old_config[rpc_api.SOFTWARE_CONFIG_INPUTS]}
|
||||
|
||||
self.properties = json_snippet.properties(self.properties_schema,
|
||||
self.context)
|
||||
|
@ -136,6 +136,21 @@ class SoftwareDeploymentTest(common.HeatTestCase):
|
||||
}
|
||||
}
|
||||
|
||||
template_update_only = {
|
||||
'HeatTemplateFormatVersion': '2012-12-12',
|
||||
'Resources': {
|
||||
'deployment_mysql': {
|
||||
'Type': 'OS::Heat::SoftwareDeployment',
|
||||
'Properties': {
|
||||
'server': '9f1f0e00-05d2-4ca5-8602-95021f19c9d0',
|
||||
'config': '48e8ade1-9196-42d5-89a2-f709fde42632',
|
||||
'input_values': {'foo': 'bar'},
|
||||
'actions': ['UPDATE'],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template_no_config = {
|
||||
'HeatTemplateFormatVersion': '2012-12-12',
|
||||
'Resources': {
|
||||
@ -881,6 +896,19 @@ class SoftwareDeploymentTest(common.HeatTestCase):
|
||||
self.deployment.handle_update,
|
||||
snippet, None, prop_diff)
|
||||
|
||||
def test_handle_update_with_update_only(self):
|
||||
self._create_stack(self.template_update_only)
|
||||
rsrc = self.stack['deployment_mysql']
|
||||
prop_diff = {
|
||||
'input_values': {'foo': 'different'}
|
||||
}
|
||||
props = copy.copy(rsrc.properties.data)
|
||||
props.update(prop_diff)
|
||||
snippet = rsrc_defn.ResourceDefinition(rsrc.name, rsrc.type(), props)
|
||||
self.deployment.handle_update(
|
||||
json_snippet=snippet, tmpl_diff=None, prop_diff=prop_diff)
|
||||
self.rpc_client.show_software_deployment.assert_not_called()
|
||||
|
||||
def test_handle_suspend_resume(self):
|
||||
self._create_stack(self.template_delete_suspend_resume)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user