Browse Source

Convergence: Allow creating stacks of empty templates

Change-Id: I25449a69a4565c2433832845b70cf32bc1cf53a9
changes/66/194266/17
Sirushti Murugesan 7 years ago
parent
commit
d4087af830
  1. 22
      heat/engine/stack.py
  2. 10
      heat/tests/test_engine_service.py

22
heat/engine/stack.py

@ -991,15 +991,19 @@ class Stack(collections.Mapping):
self.convergence_dependencies.graph().edges()]}
self.store()
for rsrc_id, is_update in self.convergence_dependencies.leaves():
LOG.info(_LI("Triggering resource %(rsrc_id)s "
"for %(is_update)s update"),
{'rsrc_id': rsrc_id, 'is_update': is_update})
input_data = {'input_data': {},
'adopt_stack_data': self.adopt_stack_data}
self.worker_client.check_resource(self.context, rsrc_id,
self.current_traversal,
input_data, is_update)
leaves = set(self.convergence_dependencies.leaves())
if not any(leaves):
self.mark_complete(self.current_traversal)
else:
for rsrc_id, is_update in self.convergence_dependencies.leaves():
LOG.info(_LI("Triggering resource %(rsrc_id)s "
"for %(is_update)s update"),
{'rsrc_id': rsrc_id, 'is_update': is_update})
input_data = {'input_data': {},
'adopt_stack_data': self.adopt_stack_data}
self.worker_client.check_resource(self.context, rsrc_id,
self.current_traversal,
input_data, is_update)
def _get_best_existing_rsrc_db(self, rsrc_name):
candidate = None

10
heat/tests/test_engine_service.py

@ -189,6 +189,16 @@ class StackConvergenceCreateUpdateDeleteTest(common.HeatTestCase):
super(StackConvergenceCreateUpdateDeleteTest, self).setUp()
cfg.CONF.set_override('convergence_engine', True)
@mock.patch.object(parser.Stack, 'mark_complete')
def test_converge_empty_template(self, mock_mc, mock_cr):
empty_tmpl = templatem.Template.create_empty_template()
stack = parser.Stack(utils.dummy_context(), 'empty_tmpl_stack',
empty_tmpl, convergence=True)
stack.store()
stack.converge_stack(template=stack.t, action=stack.CREATE)
self.assertFalse(mock_cr.called)
mock_mc.assert_called_once_with(stack.current_traversal)
def test_conv_wordpress_single_instance_stack_create(self, mock_cr):
stack = tools.get_stack('test_stack', utils.dummy_context(),
convergence=True)

Loading…
Cancel
Save