Merge "Fix for 'Cannot authenticate without an auth_url'"
This commit is contained in:
commit
e29f95ee3f
@ -87,6 +87,7 @@ class MistralContext(BaseContext):
|
|||||||
"is_trust_scoped",
|
"is_trust_scoped",
|
||||||
"redelivered",
|
"redelivered",
|
||||||
"expires_at",
|
"expires_at",
|
||||||
|
"trust_id",
|
||||||
])
|
])
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
@ -70,6 +70,7 @@ def create_context(trust_id, project_id):
|
|||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
auth_token=client.auth_token,
|
auth_token=client.auth_token,
|
||||||
is_trust_scoped=True,
|
is_trust_scoped=True,
|
||||||
|
trust_id=trust_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
return auth_ctx.MistralContext(
|
return auth_ctx.MistralContext(
|
||||||
|
@ -74,7 +74,20 @@ def get_endpoint_for_project(service_name=None, service_type=None):
|
|||||||
ctx = context.ctx()
|
ctx = context.ctx()
|
||||||
|
|
||||||
token = ctx.auth_token
|
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(
|
endpoints = select_service_endpoints(
|
||||||
service_name,
|
service_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user