Fix VMTP to support recent keystone v3 change

Change-Id: I8c793c1c6ed42f56f9b05daa7f84a654c13f55ff
This commit is contained in:
Yichen Wang 2017-02-28 17:46:39 -08:00
parent c37b276d46
commit b314547b97

View File

@ -29,8 +29,8 @@ class Credentials(object):
dct['auth_url'] = self.rc_auth_url dct['auth_url'] = self.rc_auth_url
if self.rc_identity_api_version == 3: if self.rc_identity_api_version == 3:
dct['project_name'] = self.rc_project_name dct['project_name'] = self.rc_project_name
dct['project_domain_id'] = self.rc_project_domain_id dct['project_domain_name'] = self.rc_project_domain_name
dct['user_domain_id'] = self.rc_user_domain_id dct['user_domain_name'] = self.rc_user_domain_name
else: else:
dct['tenant_name'] = self.rc_tenant_name dct['tenant_name'] = self.rc_tenant_name
return dct return dct
@ -47,8 +47,8 @@ class Credentials(object):
self.rc_cacert = False self.rc_cacert = False
self.rc_region_name = None self.rc_region_name = None
self.rc_project_name = None self.rc_project_name = None
self.rc_project_domain_id = None self.rc_project_domain_name = None
self.rc_user_domain_id = None self.rc_user_domain_name = None
self.rc_identity_api_version = 2 self.rc_identity_api_version = 2
success = True success = True
@ -89,12 +89,12 @@ class Credentials(object):
pwd = value pwd = value
elif name == "PROJECT_NAME": elif name == "PROJECT_NAME":
self.rc_project_name = value self.rc_project_name = value
elif name == "PROJECT_DOMAIN_ID" or name == "PROJECT_DOMAIN_NAME": elif name == "PROJECT_DOMAIN_NAME":
self.rc_project_domain_id = value self.rc_project_domain_name = value
elif name == "USER_DOMAIN_ID" or name == "USER_DOMAIN_NAME": elif name == "USER_DOMAIN_NAME":
self.rc_user_domain_id = value self.rc_user_domain_name = value
else: else:
LOG.error('Error: rc file does not exist %s', openrc_file) LOG.error('Error: rc file does not exist %s' % (openrc_file))
success = False success = False
elif not no_env: elif not no_env:
# no openrc file passed - we assume the variables have been # no openrc file passed - we assume the variables have been
@ -118,7 +118,7 @@ class Credentials(object):
elif self.rc_identity_api_version == 3: elif self.rc_identity_api_version == 3:
for varname in ['OS_USERNAME', 'OS_AUTH_URL', 'OS_PROJECT_NAME', for varname in ['OS_USERNAME', 'OS_AUTH_URL', 'OS_PROJECT_NAME',
'OS_PROJECT_DOMAIN_ID', 'OS_USER_DOMAIN_ID']: 'OS_PROJECT_DOMAIN_NAME', 'OS_USER_DOMAIN_NAME']:
if varname not in os.environ: if varname not in os.environ:
LOG.warning('%s is missing', varname) LOG.warning('%s is missing', varname)
success = False success = False
@ -126,8 +126,8 @@ class Credentials(object):
self.rc_username = os.environ['OS_USERNAME'] self.rc_username = os.environ['OS_USERNAME']
self.rc_auth_url = os.environ['OS_AUTH_URL'] self.rc_auth_url = os.environ['OS_AUTH_URL']
self.rc_project_name = os.environ['OS_PROJECT_NAME'] self.rc_project_name = os.environ['OS_PROJECT_NAME']
self.rc_project_domain_id = os.environ['OS_PROJECT_DOMAIN_ID'] self.rc_project_domain_name = os.environ['OS_PROJECT_DOMAIN_NAME']
self.rc_user_domain_id = os.environ['OS_USER_DOMAIN_ID'] self.rc_user_domain_name = os.environ['OS_USER_DOMAIN_NAME']
if 'OS_CACERT' in os.environ: if 'OS_CACERT' in os.environ:
self.rc_cacert = os.environ['OS_CACERT'] self.rc_cacert = os.environ['OS_CACERT']