proxy/installer/rhn_proxy_activate.py | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
New commits:
commit 7da0f03883e9b8e2d9b74304ac987981028c6e27
Author: Dimitar Yordanov <dyordano(a)redhat.com>
Date: Thu Jun 27 17:42:58 2013 +0200
979038 - Obtain default options from up2date
diff --git a/proxy/installer/rhn_proxy_activate.py
b/proxy/installer/rhn_proxy_activate.py
index e4ec562..37597cd 100644
--- a/proxy/installer/rhn_proxy_activate.py
+++ b/proxy/installer/rhn_proxy_activate.py
@@ -33,6 +33,9 @@ import xmlrpclib
from rhn import rpclib, SSL
from optparse import Option, OptionParser
+sys.path.append('/usr/share/rhn')
+from up2date_client import config
+
DEFAULT_WEBRPC_HANDLER_v3_x = '/rpc/api'
def getSystemId():
@@ -402,16 +405,19 @@ def listAvailableProxyChannels(options):
sys.stdout.write("\n".join(channel_list)+"\n")
def processCommandline():
- # FIXME: we should populate this keys from /etc/sysconfig/rhn/up2date
- rhn_parent = ''
- httpProxy = ''
- httpProxyUsername = ''
- httpProxyPassword = ''
+
+ cfg = config.initUp2dateConfig()
+ up2date_cfg = dict(cfg.items())
+
+ rhn_parent = urlparse.urlparse(up2date_cfg['serverURL'][0])[1]
+ httpProxy = urlparse.urlparse(up2date_cfg['httpProxy'][0])[1]
+ httpProxyUsername = up2date_cfg['proxyUser']
+ httpProxyPassword = up2date_cfg['proxyPassword']
if not httpProxy:
httpProxyUsername, httpProxyPassword = '', ''
if not httpProxyUsername:
httpProxyPassword = ''
- ca_cert = ''
+ ca_cert = up2date_cfg['sslCACert']
defaultVersion = '5.2'
# parse options
@@ -423,7 +429,7 @@ def processCommandline():
Option('--http-proxy-username', action='store',
default=httpProxyUsername,
help="alternative HTTP proxy usename, default is %s" %
repr(httpProxyUsername)),
Option('--http-proxy-password', action='store',
default=httpProxyPassword,
- help="alternative HTTP proxy password, default is %s" %
repr(httpProxyUsername)),
+ help="alternative HTTP proxy password, default is %s" %
repr(httpProxyPassword)),
Option('--ca-cert', action='store', default=ca_cert,
help="alternative SSL certificate to use, default is %s" %
repr(ca_cert)),
Option('--no-ssl', action='store_true',
Show replies by date