Browse Source

Make Barbican client respect OPENSTACK_ENDPOINT_TYPE

See bug for details; this uses base.py's get_url() function to fetch
the appropriate URL.  Also sets the region.

Change-Id: I9f642965eaf6b0213017c8d536e143db62399311
Closes-Bug: 1593329
changes/78/446178/1
Matt Borland 5 years ago
parent
commit
8369ddde7a
  1. 7
      neutron_lbaas_dashboard/api/rest/barbican.py

7
neutron_lbaas_dashboard/api/rest/barbican.py

@ -23,6 +23,7 @@ from keystoneclient import session
from horizon.utils.memoized import memoized # noqa
from openstack_dashboard.api import base
from openstack_dashboard.api import keystone
from openstack_dashboard.api.rest import urls
from openstack_dashboard.api.rest import utils as rest_utils
@ -31,6 +32,8 @@ from openstack_dashboard.api.rest import utils as rest_utils
@memoized
def barbicanclient(request):
project_id = request.user.project_id
region = request.user.services_region
endpoint = base.url_for(request, 'key-manager')
if keystone.get_version() < 3:
auth = auth_v2.Token(settings.OPENSTACK_KEYSTONE_URL,
request.user.token.id,
@ -41,7 +44,9 @@ def barbicanclient(request):
request.user.token.id,
project_id=project_id,
project_domain_id=domain_id)
return barbican_client.Client(session=session.Session(auth=auth))
return barbican_client.Client(session=session.Session(auth=auth),
endpoint=endpoint,
region_name=region)
@urls.register

Loading…
Cancel
Save