mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-26 04:02:11 +01:00
- all necessary auth-information are available in the 'auth_dict' (so there's no need to fool around with the ConfigParser...)
This commit is contained in:
parent
3c3e961f4e
commit
303e5dcffc
11
osc/conf.py
11
osc/conf.py
@ -115,17 +115,16 @@ def parse_apisrv_url(scheme, apisrv):
|
|||||||
def get_apiurl_usr(apiurl):
|
def get_apiurl_usr(apiurl):
|
||||||
"""
|
"""
|
||||||
returns the user for this host - if this host does not exist in the
|
returns the user for this host - if this host does not exist in the
|
||||||
configfile the default user is returned.
|
internal auth_dict the default user is returned.
|
||||||
"""
|
"""
|
||||||
import sys
|
import sys
|
||||||
scheme, apisrv = parse_apisrv_url(None, apiurl)
|
scheme, apisrv = parse_apisrv_url(None, apiurl)
|
||||||
cp = get_configParser()
|
if config['auth_dict'].has_key(apisrv):
|
||||||
try:
|
return config['auth_dict'][apisrv]['user']
|
||||||
return cp.get(apisrv, 'user')
|
else:
|
||||||
except ConfigParser.NoSectionError:
|
|
||||||
print >>sys.stderr, 'section [\'%s\'] does not exist - using default user: \'%s\'' \
|
print >>sys.stderr, 'section [\'%s\'] does not exist - using default user: \'%s\'' \
|
||||||
% (apisrv, config['user'])
|
% (apisrv, config['user'])
|
||||||
return config['user']
|
return config['user']
|
||||||
|
|
||||||
def init_basicauth(config):
|
def init_basicauth(config):
|
||||||
"""initialize urllib2 with the credentials for Basic Authentication"""
|
"""initialize urllib2 with the credentials for Basic Authentication"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user