Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
GUI-2879 added more error checking and logging when oidc credentials …
Browse files Browse the repository at this point in the history
…ini file is badly constructed
  • Loading branch information
dkavanagh committed Mar 24, 2017
1 parent 1a22744 commit 0d4785b
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions eucaconsole/views/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,23 @@ def load_oidc_credentials(settings):
logging.error("missing the oidc.client.ini file, refer to this setting in the console.ini")
return None
else:
ini = ConfigParser.ConfigParser()
with open(source) as f:
ini.readfp(f)

Creds = collections.namedtuple('oidc_creds', 'client_id client_secret')
return Creds(
client_id=ini.get('general', 'oidc.client.id'),
client_secret=ini.get('general', 'oidc.client.secret')
)
try:
ini = ConfigParser.ConfigParser()
with open(source) as f:
ini.readfp(f)
except ConfigParser.Error as err:
logging.error("Error parsing the oidc.client.ini file: " + err.message)
return None

try:
Creds = collections.namedtuple('oidc_creds', 'client_id client_secret')
return Creds(
client_id=ini.get('general', 'oidc.client.id'),
client_secret=ini.get('general', 'oidc.client.secret')
)
except ConfigParser.Error as err:
logging.error("Error reading the oidc.client.ini file: " + err.message)
return None


class LogoutView(BaseView):
Expand Down

0 comments on commit 0d4785b

Please sign in to comment.