Skip to content

Commit

Permalink
- fixed github issue #6 ("Problems with osc and gnome-keyring")
Browse files Browse the repository at this point in the history
check if user and password exist in the gnome keyring entry (a non existent
password is most likely an error so print a warning)
  • Loading branch information
marcus-h committed Jun 26, 2012
1 parent 09c66f1 commit 6ad15b3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion osc/conf.py
Expand Up @@ -803,8 +803,14 @@ def get_config(override_conffile=None,
# Read from gnome keyring if available
try:
gk_data = gnomekeyring.find_network_password_sync(protocol=scheme, server=host)
password = gk_data[0]['password']
if not 'user' in gk_data[0]:
raise oscerr.ConfigError('no user found in keyring', conffile)
user = gk_data[0]['user']
if 'password' in gk_data[0]:
password = gk_data[0]['password']
else:
# this is most likely an error
print >>sys.stderr, 'warning: no password found in keyring'
except gnomekeyring.NoMatchError:
# Fallback to file based auth.
pass
Expand Down

0 comments on commit 6ad15b3

Please sign in to comment.