Merge "Fix VIM registration error"

This commit is contained in:
Zuul 2022-01-07 01:46:47 +00:00 committed by Gerrit Code Review
commit ffe422e83d
2 changed files with 8 additions and 4 deletions

View File

@ -117,8 +117,7 @@ class OpenStack_Driver(abstract_vim_driver.VimAbstractDriver,
Initialize keystoneclient with provided authentication attributes.
"""
verify = 'True' == vim_obj['auth_cred'].get('cert_verify', 'True') \
or False
verify = 'True' == vim_obj['auth_cred'].get('cert_verify', 'True')
auth_url = vim_obj['auth_url']
keystone_version = NfvoPlugin.validate_keystone_auth_url(
auth_url=auth_url,

View File

@ -53,13 +53,18 @@ class Keystone(object):
return ses.get_endpoint(service_type, region_name)
def initialize_client(self, **kwargs):
verify = 'True' == kwargs.pop('cert_verify', 'True') or False
verify = 'True' == kwargs.pop('cert_verify', 'True')
if 'token' in kwargs:
auth_plugin = identity.v3.Token(**kwargs)
else:
auth_plugin = identity.v3.Password(**kwargs)
ses = self.get_session(auth_plugin=auth_plugin, verify=verify)
cli = client.Client(DEFAULT_IDENTITY_VERSION, session=ses)
# note: Using `interface` may be an appropriate way to control
# the keystone endpoint, e.g., client.Client(DEFAULT_IDENTITY_VERSION,
# session=ses, interface=interface), but it requires the modification
# in the DB schema. Thus, use `endpoint_override` for now.
cli = client.Client(DEFAULT_IDENTITY_VERSION, session=ses,
endpoint_override=auth_plugin.auth_url)
return cli
@staticmethod