mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-28 15:36:13 +01:00
- fixed get_config()
This commit is contained in:
parent
e040ae85f5
commit
99a75fa2e8
13
osc/conf.py
13
osc/conf.py
@ -502,10 +502,11 @@ def get_config(override_conffile = None,
|
|||||||
scheme, host = \
|
scheme, host = \
|
||||||
parse_apisrv_url(config.get('scheme', 'https'), url)
|
parse_apisrv_url(config.get('scheme', 'https'), url)
|
||||||
apiurl = urljoin(scheme, host)
|
apiurl = urljoin(scheme, host)
|
||||||
user = cp.get( url, 'user' )
|
user = None
|
||||||
if config['use_keyring'] and GENERIC_KEYRING:
|
if config['use_keyring'] and GENERIC_KEYRING:
|
||||||
try:
|
try:
|
||||||
# Read from keyring lib if available
|
# Read from keyring lib if available
|
||||||
|
user = cp.get(url, 'user', raw=True)
|
||||||
password = keyring.get_password(host, user)
|
password = keyring.get_password(host, user)
|
||||||
except:
|
except:
|
||||||
# Fallback to file based auth.
|
# Fallback to file based auth.
|
||||||
@ -538,12 +539,6 @@ def get_config(override_conffile = None,
|
|||||||
if not passwordx:
|
if not passwordx:
|
||||||
print "%s: rewriting from plain pass to encoded pass\n" % url
|
print "%s: rewriting from plain pass to encoded pass\n" % url
|
||||||
add_section(conffile, url, user, password)
|
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'):
|
if cp.has_option(url, 'http_headers'):
|
||||||
http_headers = cp.get(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,
|
api_host_options[apiurl] = { 'user': user,
|
||||||
'pass': password,
|
'pass': password,
|
||||||
'http_headers': http_headers}
|
'http_headers': http_headers}
|
||||||
if email:
|
if cp.has_option(url, 'email'):
|
||||||
api_host_options[apiurl]['email'] = email
|
api_host_options[apiurl]['email'] = cp.get(url, 'email')
|
||||||
|
|
||||||
# add the auth data we collected to the config dict
|
# add the auth data we collected to the config dict
|
||||||
config['api_host_options'] = api_host_options
|
config['api_host_options'] = api_host_options
|
||||||
|
Loading…
Reference in New Issue
Block a user