[opensuse-buildservice] Patch: add proxy_url configuration for every apiurl in oscrc

Hi, all In the practice use of osc to access obs server, we found it's convenient to set different http proxy for each apiurl in the oscrc. Especially when we need to access multiple obs in the same time. So I write a simple patch for this enhancement, pasted as follow. If something incorrect to follow osc design rule, please tell me, thanks. Patch start here: djf@djf-macbook:~/working/opensuse/osc$ cat 0001-Added-proxy_url-config-directive-in-apiurl-sections.patch
From b054f0955af1fa8a107053b5c860985523237cc8 Mon Sep 17 00:00:00 2001 From: JF Ding <jfding@gmail.com> Date: Tue, 12 Jan 2010 13:30:20 +0800 Subject: [PATCH] Added proxy_url config directive in apiurl sections
--- osc/conf.py | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/osc/conf.py b/osc/conf.py index 53a5f34..ab0ebbe 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -214,6 +214,10 @@ passx = %(passx)s # User: mumblegack # Force using of keyring for this API #keyring = 1 +# set proxy for this apiurl +# the specified proxy will be used to access this apiurl +# through http/https +#proxy_url = http://proxy.url/ """ @@ -613,6 +617,14 @@ def get_config(override_conffile = None, if not 'sslcertck' in api_host_options[apiurl]: api_host_options[apiurl]['sslcertck'] = True + if cp.has_option(url, 'proxy_url'): + # set or override env proxy settings + proxy = cp.get(url, 'proxy_url').strip() + os.environ['https_proxy'] = proxy + os.environ['http_proxy'] = proxy + os.environ['HTTPS_PROXY'] = proxy + os.environ['HTTP_PROXY'] = proxy + # add the auth data we collected to the config dict config['api_host_options'] = api_host_options config['apiurl_aliases'] = aliases -- 1.6.6 Regards, Jian-feng Ding -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (1)
-
JF Ding