summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-10-07 06:17:02 +0000
committerGerrit Code Review <review@openstack.org>2016-10-07 06:17:02 +0000
commit0c51361b6231afca8d3786fa5b832538554fe0fc (patch)
tree4b40a9dd036ab1fae01e3039b3094dd3e9f87783
parent7b7502fc3a5de460bf1c9641119b17b1db71490d (diff)
parentea0ba0ae45cbbc243161797efc6bfde0fb707682 (diff)
downloadheat-0c51361b6231afca8d3786fa5b832538554fe0fc.tar.gz
Merge "Don't get derived config if resource ID unset" into stable/newton
-rw-r--r--heat/engine/resources/openstack/heat/software_deployment.py12
-rw-r--r--heat/tests/openstack/heat/test_software_deployment.py28
2 files changed, 36 insertions, 4 deletions
diff --git a/heat/engine/resources/openstack/heat/software_deployment.py b/heat/engine/resources/openstack/heat/software_deployment.py
index 43dabc1ba..018d0071f 100644
--- a/heat/engine/resources/openstack/heat/software_deployment.py
+++ b/heat/engine/resources/openstack/heat/software_deployment.py
@@ -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)
diff --git a/heat/tests/openstack/heat/test_software_deployment.py b/heat/tests/openstack/heat/test_software_deployment.py
index f9f73df00..5d5de17aa 100644
--- a/heat/tests/openstack/heat/test_software_deployment.py
+++ b/heat/tests/openstack/heat/test_software_deployment.py
@@ -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)