summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-10-24 20:55:36 +0000
committerGerrit Code Review <review@openstack.org>2018-10-24 20:55:36 +0000
commit7524e615b2b735b26da44a45c356de801eb21bec (patch)
treecf1c4a928ec1ad2dedc887ae6ce3e5ed62f0eb24
parent3a7ce2ed9ea4f1cb25ca6dab0c5b50f5fb8f5fee (diff)
parentaed195c8d8ee0cb9ece00327517517f1f7d796f1 (diff)
downloadheat-7524e615b2b735b26da44a45c356de801eb21bec.tar.gz
Merge "Update resource definitions after legacy in-place update" into stable/pike
-rw-r--r--heat/engine/update.py2
-rw-r--r--heat/tests/openstack/heat/test_value.py6
-rw-r--r--heat_integrationtests/functional/test_create_update.py36
3 files changed, 41 insertions, 3 deletions
diff --git a/heat/engine/update.py b/heat/engine/update.py
index 3bd96cc3a..cd8baba62 100644
--- a/heat/engine/update.py
+++ b/heat/engine/update.py
@@ -184,6 +184,8 @@ class StackUpdate(object):
res_name)
self.previous_stack.t.add_resource(new_res.t)
self.previous_stack.t.store(self.previous_stack.context)
+ self.existing_stack.t.add_resource(new_res.t)
+ self.existing_stack.t.store(self.existing_stack.context)
LOG.info("Resource %(res_name)s for stack "
"%(stack_name)s updated",
diff --git a/heat/tests/openstack/heat/test_value.py b/heat/tests/openstack/heat/test_value.py
index 2f75c8d22..0ce0a500e 100644
--- a/heat/tests/openstack/heat/test_value.py
+++ b/heat/tests/openstack/heat/test_value.py
@@ -226,7 +226,7 @@ class TestValueUpdate(TestValue):
param2=True, param_type2="boolean")),
]
- def test_value(self):
+ def test_value_update(self):
ts1, tl1 = self.get_strict_and_loose_templates(self.param_type1)
ts2, tl2 = self.get_strict_and_loose_templates(self.param_type2)
@@ -244,7 +244,7 @@ class TestValueUpdate(TestValue):
else:
# starting with param2, updating to param1
p2, p1, e2, e1 = self.param1, self.param2, env1, env2
- stack = self.create_stack(t_initial, env=e1)
+ stack = self.create_stack(copy.deepcopy(t_initial), env=e1)
self.assertEqual(p1, stack['my_value2'].FnGetAtt('value'))
res1_id = stack['my_value'].id
res2_id = stack['my_value2'].id
@@ -252,7 +252,7 @@ class TestValueUpdate(TestValue):
updated_stack = parser.Stack(
stack.context, 'updated_stack',
- template.Template(t_updated, env=e2))
+ template.Template(copy.deepcopy(t_updated), env=e2))
updated_stack.validate()
stack.update(updated_stack)
self.assertEqual(p2, stack['my_value2'].FnGetAtt('value'))
diff --git a/heat_integrationtests/functional/test_create_update.py b/heat_integrationtests/functional/test_create_update.py
index 4b06fcb33..1e4248622 100644
--- a/heat_integrationtests/functional/test_create_update.py
+++ b/heat_integrationtests/functional/test_create_update.py
@@ -722,3 +722,39 @@ resources:
}
}
self._test_conditional(test3)
+
+ def test_inplace_update_old_ref_deleted_failed_stack(self):
+ template = '''
+heat_template_version: pike
+resources:
+ test1:
+ type: OS::Heat::TestResource
+ properties:
+ value: test
+ test2:
+ type: OS::Heat::TestResource
+ properties:
+ value: {get_attr: [test1, output]}
+ test3:
+ type: OS::Heat::TestResource
+ properties:
+ value: test3
+ fail: false
+ action_wait_secs:
+ update: 5
+'''
+ stack_identifier = self.stack_create(
+ template=template)
+
+ _template = template.replace('test1:',
+ 'test-1:').replace('fail: false',
+ 'fail: true')
+ updated_template = _template.replace(
+ '{get_attr: [test1',
+ '{get_attr: [test-1').replace('value: test3',
+ 'value: test-3')
+ self.update_stack(stack_identifier,
+ template=updated_template,
+ expected_status='UPDATE_FAILED')
+ self.update_stack(stack_identifier, template=template,
+ expected_status='UPDATE_COMPLETE')