Fix the API which breaks the UI login
Change-Id: I4ded9f99872255a1f593134831d3f7e19dead007
This commit is contained in:
parent
fa59993e87
commit
8653294867
@ -139,12 +139,14 @@ class ConfigController(object):
|
|||||||
|
|
||||||
# Parsing credentials from application input
|
# Parsing credentials from application input
|
||||||
cred_config = user_config['credentials']
|
cred_config = user_config['credentials']
|
||||||
cred_tested = Credentials(openrc_contents=cred_config['tested-rc'],
|
cred_tested = Credentials(openrc=cred_config['tested-rc'].splitlines(),
|
||||||
pwd=cred_config['tested-passwd'])
|
is_file=False,
|
||||||
|
pwd=cred_config.get('tested-passwd', None))
|
||||||
if ('testing-rc' in cred_config and
|
if ('testing-rc' in cred_config and
|
||||||
cred_config['testing-rc'] != cred_config['tested-rc']):
|
cred_config['testing-rc'] != cred_config['tested-rc']):
|
||||||
cred_testing = Credentials(openrc_contents=cred_config['testing-rc'],
|
cred_testing = Credentials(openrc=cred_config['testing-rc'].splitlines(),
|
||||||
pwd=cred_config['testing-passwd'])
|
is_file=False,
|
||||||
|
pwd=cred_config.get('testing-passwd', None))
|
||||||
else:
|
else:
|
||||||
# Use the same openrc file for both cases
|
# Use the same openrc file for both cases
|
||||||
cred_testing = cred_tested
|
cred_testing = cred_tested
|
||||||
|
@ -118,7 +118,7 @@ class Credentials(object):
|
|||||||
# Read a openrc file and take care of the password
|
# Read a openrc file and take care of the password
|
||||||
# The 2 args are passed from the command line and can be None
|
# The 2 args are passed from the command line and can be None
|
||||||
#
|
#
|
||||||
def __init__(self, openrc_file, pwd=None, no_env=False):
|
def __init__(self, openrc, is_file=True, pwd=None, no_env=False):
|
||||||
self.rc_password = None
|
self.rc_password = None
|
||||||
self.rc_username = None
|
self.rc_username = None
|
||||||
self.rc_tenant_name = None
|
self.rc_tenant_name = None
|
||||||
@ -131,15 +131,15 @@ class Credentials(object):
|
|||||||
self.rc_identity_api_version = 2
|
self.rc_identity_api_version = 2
|
||||||
success = True
|
success = True
|
||||||
|
|
||||||
if openrc_file:
|
if openrc:
|
||||||
if isinstance(openrc_file, str):
|
if is_file:
|
||||||
if os.path.exists(openrc_file):
|
if os.path.exists(openrc):
|
||||||
self.__parse_openrc(open(openrc_file))
|
self.__parse_openrc(open(openrc).readlines())
|
||||||
else:
|
else:
|
||||||
LOG.error('Error: rc file does not exist %s', openrc_file)
|
LOG.error('Error: rc file does not exist %s', openrc)
|
||||||
success = False
|
success = False
|
||||||
else:
|
else:
|
||||||
self.__parse_openrc(openrc_file)
|
self.__parse_openrc(openrc)
|
||||||
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
|
||||||
# sourced by the calling shell
|
# sourced by the calling shell
|
||||||
|
Loading…
x
Reference in New Issue
Block a user