Keystone v3 support
Change-Id: Ib42448410ed44938058c228cf549ac56937dcde9
This commit is contained in:
parent
9784d01265
commit
6515ff80d6
|
@ -21,6 +21,7 @@ from cueclient.v1 import client
|
|||
from django.conf import settings
|
||||
from horizon.utils.memoized import memoized # noqa
|
||||
from keystoneclient.auth.identity import v2
|
||||
from keystoneclient.auth.identity import v3
|
||||
from keystoneclient import session as ksc_session
|
||||
from openstack_dashboard import api
|
||||
|
||||
|
@ -28,10 +29,18 @@ from openstack_dashboard import api
|
|||
@memoized
|
||||
def cueclient(request):
|
||||
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
||||
auth_url = api.base.url_for(request, 'identity')
|
||||
auth = v2.Token(auth_url, request.user.token.id,
|
||||
tenant_id=request.user.tenant_id,
|
||||
tenant_name=request.user.tenant_name)
|
||||
auth_url = getattr(settings, 'OPENSTACK_KEYSTONE_URL')
|
||||
auth_version = getattr(settings,
|
||||
'OPENSTACK_API_VERSIONS', {}).get('identity', 2.0)
|
||||
if auth_version == 3:
|
||||
auth = v3.Token(auth_url, request.user.token.id,
|
||||
project_id=request.user.project_id,
|
||||
project_name=request.user.project_name)
|
||||
elif auth_version == 2 or auth_version == 2.0:
|
||||
auth = v2.Token(auth_url, request.user.token.id,
|
||||
tenant_id=request.user.tenant_id,
|
||||
tenant_name=request.user.tenant_name)
|
||||
|
||||
session = ksc_session.Session(auth=auth, verify=cacert)
|
||||
return client.Client(session=session)
|
||||
|
||||
|
|
|
@ -79,11 +79,11 @@ HORIZON_CONFIG = {
|
|||
HORIZON_IMAGES_ALLOW_UPLOAD = True
|
||||
|
||||
AVAILABLE_REGIONS = [
|
||||
('http://localhost:5000/v2.0', 'local'),
|
||||
('http://remote:5000/v2.0', 'remote'),
|
||||
('http://localhost:5000/v3', 'local'),
|
||||
('http://remote:5000/v3', 'remote'),
|
||||
]
|
||||
|
||||
OPENSTACK_KEYSTONE_URL = "http://localhost:5000/v2.0"
|
||||
OPENSTACK_KEYSTONE_URL = "http://localhost:5000/v3"
|
||||
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_"
|
||||
|
||||
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
|
||||
|
|
Loading…
Reference in New Issue