From 303e5dcffc3d754ae8d0c900ffd9bec9f99b3542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20H=C3=BCwe?= Date: Tue, 18 Mar 2008 13:51:57 +0000 Subject: [PATCH] - all necessary auth-information are available in the 'auth_dict' (so there's no need to fool around with the ConfigParser...) --- osc/conf.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osc/conf.py b/osc/conf.py index 98c649a8..fad364cd 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -115,17 +115,16 @@ def parse_apisrv_url(scheme, apisrv): def get_apiurl_usr(apiurl): """ 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 scheme, apisrv = parse_apisrv_url(None, apiurl) - cp = get_configParser() - try: - return cp.get(apisrv, 'user') - except ConfigParser.NoSectionError: + if config['auth_dict'].has_key(apisrv): + return config['auth_dict'][apisrv]['user'] + else: print >>sys.stderr, 'section [\'%s\'] does not exist - using default user: \'%s\'' \ % (apisrv, config['user']) - return config['user'] + return config['user'] def init_basicauth(config): """initialize urllib2 with the credentials for Basic Authentication"""