Skip to content

Commit

Permalink
Provide sane error message in case password is not found in configfile
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Mar 4, 2014
1 parent de96443 commit 793616f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion osc/cli/cli.py
Expand Up @@ -36,10 +36,14 @@ def _init(apiurl):
aliases = aliases.split(',')
if section.strip('/') == apiurl or apiurl in aliases:
user = cp.get(section, 'user', raw=True)
password = cp.get(section, 'pass', raw=True)
password = None
if cp.has_option(section, 'pass'):
password = cp.get(section, 'pass', raw=True)
if cp.has_option(section, 'passx'):
password = cp.get(section, 'pass', raw=True)
password = password.decode('base64').decode('bz2')
if password is None:
raise ValueError('No password provided for {0}'.format(section))
Osc.init(section, username=user, password=password)
return section

Expand Down

0 comments on commit 793616f

Please sign in to comment.