1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 09:56:13 +01:00

- don't need config['pass'] anymore

- but set config['user'], which was unset since the recent changes in auth handling
This commit is contained in:
Dr. Peter Poeml 2007-05-10 14:29:04 +00:00
parent 293d87dbe7
commit 0d9278229c
2 changed files with 5 additions and 3 deletions

View File

@ -56,6 +56,10 @@ class Osc(cmdln.Cmdln):
conf.parse_apisrv_url(conf.config['scheme'], self.global_opts.apisrv)
conf.config['apiurl'] = conf.config['scheme'] + '://' + conf.config['apisrv']
# XXX unless config['user'] goes away (and is replaced with a handy function, or
# config becomes an object, even better), set the global 'user' here as well:
conf.config['user'] = conf.config['auth_dict'][conf.config['apisrv']]['user']
# finally, initialize urllib2 for to use the credentials for Basic Authentication
conf.init_basicauth(conf.config)

View File

@ -19,7 +19,6 @@ The configuration dictionary could look like this:
{'apisrv': 'https://api.opensuse.org/',
'user': 'poeml',
'pass': 'secret',
'auth_dict': {'api.opensuse.org': {'user': 'poeml', 'pass': 'secret'},
'apitest.opensuse.org': {'user': 'poeml', 'pass': 'secret'},
'foo.opensuse.org': {'user': 'foo', 'pass': 'foo'}},
@ -42,7 +41,6 @@ config = { }
DEFAULTS = { 'apisrv': 'https://api.opensuse.org/',
'scheme': 'https',
'user': 'your_username',
'pass': 'your_password',
'packagecachedir': '/var/tmp/osbuild-packagecache',
'su-wrapper': 'su -c',
'build-cmd': '/usr/bin/build',
@ -178,7 +176,7 @@ def get_config():
# note that it is not suited for credentials containing spaces
import netrc
try:
# FIXME: apisrv is a URL now
# XXX: apisrv is a URL now, thus requiring the "scheme" setting if https is to be used
netrc_host = parse_apisrv_url(None, DEFAULTS['apisrv'])[1]
config['user'], account, config['pass'] = \
netrc.netrc().authenticators(netrc_host)