[Triggers] Fix running openstack actions via triggers
Change-Id: I49f77861825e6c7bd91f7de74f44ff02cefb04c8 Closes-Bug: #1709566
This commit is contained in:
parent
bb30b1b51a
commit
8a1572a7e8
|
@ -64,10 +64,18 @@ def create_context(trust_id, project_id):
|
|||
if CONF.pecan.auth_enable:
|
||||
client = keystone.client_for_trusts(trust_id)
|
||||
|
||||
if client.session:
|
||||
# Method get_token is deprecated, using get_auth_headers.
|
||||
token = client.session.get_auth_headers().get('X-Auth-Token')
|
||||
user_id = client.session.get_user_id()
|
||||
else:
|
||||
token = client.auth_token
|
||||
user_id = client.user_id
|
||||
|
||||
return auth_ctx.MistralContext(
|
||||
user=client.user_id,
|
||||
user=user_id,
|
||||
tenant=project_id,
|
||||
auth_token=client.auth_token,
|
||||
auth_token=token,
|
||||
is_trust_scoped=True,
|
||||
trust_id=trust_id,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue