Fix for 'Cannot authenticate without an auth_url'
Only Mistral Cron execution failing to get endpoint for the OpenStack Services. Change-Id: I985a8d21fe48b488eb7e452d31b016e8239a5752 Closes-Bug: 1607788
This commit is contained in:
parent
c7bf9bb91a
commit
9a60c02b77
@ -87,6 +87,7 @@ class MistralContext(BaseContext):
|
||||
"is_trust_scoped",
|
||||
"redelivered",
|
||||
"expires_at",
|
||||
"trust_id",
|
||||
])
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -70,6 +70,7 @@ def create_context(trust_id, project_id):
|
||||
project_id=project_id,
|
||||
auth_token=client.auth_token,
|
||||
is_trust_scoped=True,
|
||||
trust_id=trust_id,
|
||||
)
|
||||
|
||||
return auth_ctx.MistralContext(
|
||||
|
@ -74,7 +74,20 @@ def get_endpoint_for_project(service_name=None, service_type=None):
|
||||
ctx = context.ctx()
|
||||
|
||||
token = ctx.auth_token
|
||||
response = client().tokens.get_token_data(token, include_catalog=True)
|
||||
|
||||
if (ctx.is_trust_scoped and is_token_trust_scoped(token)):
|
||||
if ctx.trust_id is None:
|
||||
raise Exception(
|
||||
"'trust_id' must be provided in the admin context."
|
||||
)
|
||||
|
||||
trust_client = client_for_trusts(ctx.trust_id)
|
||||
response = trust_client.tokens.get_token_data(
|
||||
token,
|
||||
include_catalog=True
|
||||
)
|
||||
else:
|
||||
response = client().tokens.get_token_data(token, include_catalog=True)
|
||||
|
||||
endpoints = select_service_endpoints(
|
||||
service_name,
|
||||
|
Loading…
Reference in New Issue
Block a user