1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 02:16:12 +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.parse_apisrv_url(conf.config['scheme'], self.global_opts.apisrv)
conf.config['apiurl'] = conf.config['scheme'] + '://' + conf.config['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 # finally, initialize urllib2 for to use the credentials for Basic Authentication
conf.init_basicauth(conf.config) conf.init_basicauth(conf.config)

View File

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