Merge "exception when running 'watcher actionplan start XXX'"

This commit is contained in:
Jenkins 2017-04-13 11:59:45 +00:00 committed by Gerrit Code Review
commit 2e8fb5a821
2 changed files with 12 additions and 4 deletions

3
watcher/applier/default.py Normal file → Executable file
View File

@ -58,5 +58,6 @@ class DefaultApplier(base.BaseApplier):
LOG.debug("Executing action plan %s ", action_plan_uuid)
filters = {'action_plan_uuid': action_plan_uuid}
actions = objects.Action.list(self.context, filters=filters)
actions = objects.Action.list(self.context, filters=filters,
eager=True)
return self.engine.execute(actions)

View File

@ -40,9 +40,16 @@ class TestDefaultActionPlanHandler(base.DbTestCase):
self.addCleanup(p_action_plan_notifications.stop)
obj_utils.create_test_goal(self.context)
obj_utils.create_test_strategy(self.context)
obj_utils.create_test_audit(self.context)
self.action_plan = obj_utils.create_test_action_plan(self.context)
self.strategy = obj_utils.create_test_strategy(self.context)
self.audit = obj_utils.create_test_audit(
self.context, strategy_id=self.strategy.id)
self.action_plan = obj_utils.create_test_action_plan(
self.context, audit_id=self.audit.id,
strategy_id=self.strategy.id)
self.action = obj_utils.create_test_action(
self.context, action_plan_id=self.action_plan.id,
action_type='nop',
input_parameters={'message': 'hello World'})
@mock.patch.object(objects.ActionPlan, "get_by_uuid")
def test_launch_action_plan(self, m_get_action_plan):