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
|
||||
cred_config = user_config['credentials']
|
||||
cred_tested = Credentials(openrc_contents=cred_config['tested-rc'],
|
||||
pwd=cred_config['tested-passwd'])
|
||||
cred_tested = Credentials(openrc=cred_config['tested-rc'].splitlines(),
|
||||
is_file=False,
|
||||
pwd=cred_config.get('tested-passwd', None))
|
||||
if ('testing-rc' in cred_config and
|
||||
cred_config['testing-rc'] != cred_config['tested-rc']):
|
||||
cred_testing = Credentials(openrc_contents=cred_config['testing-rc'],
|
||||
pwd=cred_config['testing-passwd'])
|
||||
cred_testing = Credentials(openrc=cred_config['testing-rc'].splitlines(),
|
||||
is_file=False,
|
||||
pwd=cred_config.get('testing-passwd', None))
|
||||
else:
|
||||
# Use the same openrc file for both cases
|
||||
cred_testing = cred_tested
|
||||
|
@ -118,7 +118,7 @@ class Credentials(object):
|
||||
# Read a openrc file and take care of the password
|
||||
# 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_username = None
|
||||
self.rc_tenant_name = None
|
||||
@ -131,15 +131,15 @@ class Credentials(object):
|
||||
self.rc_identity_api_version = 2
|
||||
success = True
|
||||
|
||||
if openrc_file:
|
||||
if isinstance(openrc_file, str):
|
||||
if os.path.exists(openrc_file):
|
||||
self.__parse_openrc(open(openrc_file))
|
||||
if openrc:
|
||||
if is_file:
|
||||
if os.path.exists(openrc):
|
||||
self.__parse_openrc(open(openrc).readlines())
|
||||
else:
|
||||
LOG.error('Error: rc file does not exist %s', openrc_file)
|
||||
LOG.error('Error: rc file does not exist %s', openrc)
|
||||
success = False
|
||||
else:
|
||||
self.__parse_openrc(openrc_file)
|
||||
self.__parse_openrc(openrc)
|
||||
elif not no_env:
|
||||
# no openrc file passed - we assume the variables have been
|
||||
# sourced by the calling shell
|
||||
|
Loading…
x
Reference in New Issue
Block a user