Fixed lack of context for triggers

If set auth_enable to false in Mistral config keystone would not be used. So
triggers would not get a trust_id. Without this id context is not assigned.

Change-Id: I6d7d99da08cd78c1db83afff6fb79d37816f99ff
Closes-Bug: #1473980
This commit is contained in:
Rinat Sabitov 2015-07-15 17:08:46 +03:00
parent ec5cff34ac
commit 0a8fd07a0e
2 changed files with 24 additions and 2 deletions

View File

@ -61,8 +61,6 @@ def create_context(trust_id, project_id):
:param project_id: Project Id.
:return: Mistral security context.
"""
if not trust_id:
return
if CONF.pecan.auth_enable:
client = keystone.client_for_trusts(trust_id)

View File

@ -70,3 +70,27 @@ class ProcessCronTriggerTest(base.EngineTestCase):
# Checking the workflow was executed, by
# verifying that the next execution time changed.
self.assertNotEqual(next_execution_before, next_execution_after)
def test_workflow_without_auth(self):
cfg.CONF.set_default('auth_enable', False, group='pecan')
wf = workflows.create_workflows(WORKFLOW_LIST)[0]
t_s.create_cron_trigger(
'test',
wf.name,
{},
{},
'* * * * * */1',
None,
None,
None
)
m_p_t = periodic.MistralPeriodicTasks(cfg.CONF)
next_cron_trigger = t_s.get_next_cron_triggers()[0]
next_execution_before = next_cron_trigger.next_execution_time
m_p_t.process_cron_triggers_v2(None)
next_cron_trigger = t_s.get_next_cron_triggers()[0]
next_execution_after = next_cron_trigger.next_execution_time
self.assertNotEqual(next_execution_before, next_execution_after)