1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-11 16:36:14 +01:00

- fixed github issue #6 ("Problems with osc and gnome-keyring")

check if user and password exist in the gnome keyring entry (a non existent
password is most likely an error so print a warning)
This commit is contained in:
Marcus Huewe 2012-06-26 21:18:28 +02:00
parent 09c66f1d3d
commit 6ad15b3832

View File

@ -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