1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-27 07:06:13 +01:00

- fixed get_config()

This commit is contained in:
Marcus Hüwe 2009-09-06 21:19:40 +00:00
parent e040ae85f5
commit 99a75fa2e8

View File

@ -502,10 +502,11 @@ def get_config(override_conffile = None,
scheme, host = \
parse_apisrv_url(config.get('scheme', 'https'), url)
apiurl = urljoin(scheme, host)
user = cp.get( url, 'user' )
user = None
if config['use_keyring'] and GENERIC_KEYRING:
try:
# Read from keyring lib if available
user = cp.get(url, 'user', raw=True)
password = keyring.get_password(host, user)
except:
# Fallback to file based auth.
@ -538,12 +539,6 @@ def get_config(override_conffile = None,
if not passwordx:
print "%s: rewriting from plain pass to encoded pass\n" % url
add_section(conffile, url, user, password)
if cp.has_option(url, 'keyring') and cp.get(url, 'keyring'):
# This APIURL was configured to use keyring by
continue
email = ''
if cp.has_option(url, 'email'):
email = cp.get(url, 'email')
if cp.has_option(url, 'http_headers'):
http_headers = cp.get(url, 'http_headers')
@ -563,8 +558,8 @@ def get_config(override_conffile = None,
api_host_options[apiurl] = { 'user': user,
'pass': password,
'http_headers': http_headers}
if email:
api_host_options[apiurl]['email'] = email
if cp.has_option(url, 'email'):
api_host_options[apiurl]['email'] = cp.get(url, 'email')
# add the auth data we collected to the config dict
config['api_host_options'] = api_host_options