Support Keystone versionless endpoints
Uses keystone.client instead of keystone.client.v3 with session and auth to return a keystone client with the discovered URL. Also sets project_domain_name and user_domain_name do "Default" as they are expected by Keystone. Change-Id: I8fce922e2907584138a132f37887f227eabe9abe Partial-Bug: #1688320
This commit is contained in:
parent
67d9ed2491
commit
fa85b97313
@ -43,7 +43,7 @@ options:
|
|||||||
description:
|
description:
|
||||||
- The domain login_user belongs to
|
- The domain login_user belongs to
|
||||||
required: false
|
required: false
|
||||||
default: None
|
default: 'Default'
|
||||||
login_password:
|
login_password:
|
||||||
description:
|
description:
|
||||||
- Password of login user
|
- Password of login user
|
||||||
@ -58,7 +58,7 @@ options:
|
|||||||
description:
|
description:
|
||||||
- The domain login_project belongs to
|
- The domain login_project belongs to
|
||||||
required: false
|
required: false
|
||||||
default: None
|
default: 'Default'
|
||||||
login_tenant_name:
|
login_tenant_name:
|
||||||
description:
|
description:
|
||||||
- The tenant login_user belongs to
|
- The tenant login_user belongs to
|
||||||
@ -452,7 +452,10 @@ COMMAND_MAP = {
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from keystoneclient import exceptions as kexceptions
|
from keystoneclient import exceptions as kexceptions
|
||||||
from keystoneclient.v3 import client
|
from keystoneclient import client
|
||||||
|
from keystoneauth1.identity import v3
|
||||||
|
from keystoneauth1 import session
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
keystoneclient_found = False
|
keystoneclient_found = False
|
||||||
else:
|
else:
|
||||||
@ -591,19 +594,24 @@ class ManageKeystone(object):
|
|||||||
token=token
|
token=token
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
client_args = {
|
auth_args = {
|
||||||
'auth_url': endpoint,
|
'auth_url': endpoint,
|
||||||
'insecure': insecure,
|
|
||||||
'username': login_user,
|
'username': login_user,
|
||||||
'user_domain_name': user_domain_name,
|
'user_domain_name': user_domain_name,
|
||||||
'password': login_password,
|
'password': login_password,
|
||||||
'project_name': login_project_name,
|
'project_name': login_project_name,
|
||||||
'project_domain_name': project_domain_name,
|
'project_domain_name': project_domain_name,
|
||||||
}
|
}
|
||||||
|
client_args = {
|
||||||
|
'insecure': insecure,
|
||||||
|
}
|
||||||
|
|
||||||
if variables_dict.pop('ignore_catalog'):
|
if variables_dict.pop('ignore_catalog'):
|
||||||
client_args.update(endpoint_override=endpoint)
|
client_args.update(endpoint_override=endpoint)
|
||||||
self.keystone = client.Client(**client_args)
|
auth = v3.Password(**auth_args)
|
||||||
|
sess = session.Session(auth=auth)
|
||||||
|
self.keystone = client.Client(session=sess,
|
||||||
|
**client_args)
|
||||||
|
|
||||||
def _get_domain_from_vars(self, variables):
|
def _get_domain_from_vars(self, variables):
|
||||||
# NOTE(sigmavirus24): Since we don't require domain, this will be None
|
# NOTE(sigmavirus24): Since we don't require domain, this will be None
|
||||||
@ -1299,7 +1307,8 @@ def main():
|
|||||||
required=False
|
required=False
|
||||||
),
|
),
|
||||||
login_user_domain_name=dict(
|
login_user_domain_name=dict(
|
||||||
required=False
|
required=False,
|
||||||
|
default='Default'
|
||||||
),
|
),
|
||||||
login_password=dict(
|
login_password=dict(
|
||||||
required=False,
|
required=False,
|
||||||
@ -1312,7 +1321,8 @@ def main():
|
|||||||
required=False
|
required=False
|
||||||
),
|
),
|
||||||
login_project_domain_name=dict(
|
login_project_domain_name=dict(
|
||||||
required=False
|
required=False,
|
||||||
|
default='Default'
|
||||||
),
|
),
|
||||||
token=dict(
|
token=dict(
|
||||||
required=False
|
required=False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user