Don't set stack updated_time when creating it

Change-Id: Iaaa39c44d5e40aa719138af443ba504eb13d1c75
Partial-Bug:#1512343
changes/49/240849/1
Anant Patil 7 years ago
parent a089c6724a
commit 5916bb0a0e
  1. 7
      heat/engine/stack.py
  2. 14
      heat/tests/test_convg_stack.py

@ -985,7 +985,7 @@ class Stack(collections.Mapping):
@profiler.trace('Stack.converge_stack', hide_args=False)
def converge_stack(self, template, action=UPDATE, new_stack=None):
"""Updates the stack and triggers convergence for resources."""
"""Update the stack and triggers convergence for resources."""
if action not in [self.CREATE, self.ADOPT]:
# no back-up template for create action
self.prev_raw_template_id = getattr(self.t, 'id', None)
@ -997,7 +997,10 @@ class Stack(collections.Mapping):
previous_traversal = self.current_traversal
self.current_traversal = uuidutils.generate_uuid()
self.updated_time = datetime.datetime.utcnow()
if action is not self.CREATE:
self.updated_time = datetime.datetime.utcnow()
if new_stack is not None:
self.disable_rollback = new_stack.disable_rollback
self.timeout_mins = new_stack.timeout_mins

@ -443,6 +443,20 @@ class StackConvergenceCreateUpdateDeleteTest(common.HeatTestCase):
# should return resource with template id 2 which is prev template
self.assertEqual(a_res_2.id, best_res.id)
def test_updated_time(self, mock_cr):
stack = parser.Stack(utils.dummy_context(), 'convg_updated_time_test',
templatem.Template.create_empty_template())
stack.store()
stack.create()
self.assertIsNone(stack.updated_time)
tmpl = {'HeatTemplateFormatVersion': '2012-12-12',
'Resources': {'R1': {'Type': 'GenericResourceType'}}}
newstack = parser.Stack(utils.dummy_context(), 'updated_time_test',
templatem.Template(tmpl))
stack.update(newstack)
self.assertIsNotNone(stack.updated_time)
class TestConvgStackRollback(common.HeatTestCase):

Loading…
Cancel
Save