Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 684895 Details for
Bug 873657
[PATCH] Allow proxy between CDS and client systems in rhui-lb.py (yum plugin for RHUI)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Revised version
rh-rhui-tools-2.1.10_client-yum-plugin_proxy.patch (text/plain), 4.95 KB, created by
Satoru SATOH
on 2013-01-22 07:02:24 UTC
(
hide
)
Description:
Revised version
Filename:
MIME Type:
Creator:
Satoru SATOH
Created:
2013-01-22 07:02:24 UTC
Size:
4.95 KB
patch
obsolete
>diff -up rh-rhui-tools-2.1.10/etc/rhui/client-yum-plugin/rhui-lb.py.proxy rh-rhui-tools-2.1.10/etc/rhui/client-yum-plugin/rhui-lb.py >--- rh-rhui-tools-2.1.10/etc/rhui/client-yum-plugin/rhui-lb.py.proxy 2012-11-02 11:19:49.423934938 +0900 >+++ rh-rhui-tools-2.1.10/etc/rhui/client-yum-plugin/rhui-lb.py 2012-11-02 14:20:04.405136870 +0900 >@@ -11,7 +11,9 @@ > # have received a copy of GPLv2 along with this software; if not, see > # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. > >-import httplib >+import re >+import urlgrabber >+import urllib > import urlparse > > from yum.plugins import TYPE_CORE >@@ -21,6 +23,38 @@ requires_api_version = '2.5' > plugin_type = (TYPE_CORE,) > > >+def __make_ugopts(conduit): >+ """ >+ Setup urlgrabber options w/ parameters from config files, both main >+ (/etc/yum.conf) and plugin's conf (/etc/yum/pluginconf.d/rhui-lb.conf). >+ >+ NOTE: plugin's conf is given priority over yum's main conf. >+ """ >+ conf = conduit.getConf() >+ opts = dict(timeout=10, ssl_ca_cert="/etc/pki/entitlement/ca.crt") >+ >+ proxy = conduit.confString("main", "proxy", conf.proxy) >+ if proxy: >+ proxy_username = conduit.confString("main", "proxy_username", >+ conf.proxy_username) >+ >+ # Stolen from yum.yumRepo.YumRepository.doProxyDict() >+ if proxy_username: >+ auth = urllib.quote(proxy_username) >+ >+ proxy_password = conduit.confString("main", "proxy_password", >+ conf.proxy_password) >+ if proxy_password: >+ auth += ':' + urllib.quote(proxy_password) >+ >+ proto, rest = re.match("(\w+://)(.+)", proxy).groups() >+ proxy = "%s%s@%s" % (proto, auth, rest) >+ >+ opts["proxies"] = dict(https=proxy, HTTPS=proxy) >+ >+ return opts >+ >+ > def postreposetup_hook(conduit): > """ > Once the repo has been set up, look to the load balancer listing file >@@ -51,38 +85,39 @@ def postreposetup_hook(conduit): > > # Figure out which load balancer is up > up_lb = None >+ ugopts = __make_ugopts(conduit) >+ > for lb in cds_balancers: > try: >- conn = httplib.HTTPSConnection(lb) >- conn.request('GET', '/pulp/mirror/?members') >- conn.sock.settimeout(10) >- response = conn.getresponse() >- >- if response.status == 200: >- up_lb = lb >- >- # Make sure the known list of load balancers is accurate. >- # If not, update the listing file. >- response_body = response.read() >- response_balancers = response_body.split() >- >- # We want to attempt to retain the order of the balancer list file, >- # so it's not as simple as sorting them and doing an equality check. >- >- # First, remove any from the local list that aren't in the new list. >- modified = [x for x in cds_balancers if x in response_balancers] >- >- # Then, add any new ones to the end of the local list. >- modified = modified + [x for x in response_balancers if x not in modified] >- >- # If any changes have been made, save to the listing file. >- if modified != cds_balancers: >- f = open(cds_list_filename, 'w') >- f.write('\n'.join(modified)) >- f.close() >+ url = "https://%s/pulp/mirror/?members" % lb >+ data = urlgrabber.urlread(url, **ugopts) >+ >+ up_lb = lb >+ >+ # Make sure the known list of load balancers is accurate. >+ # If not, update the listing file. >+ response_balancers = data.split() >+ >+ # We want to attempt to retain the order of the balancer list file, >+ # so it's not as simple as sorting them and doing an equality check. >+ >+ # First, remove any from the local list that aren't in the new list. >+ modified = [x for x in cds_balancers if x in response_balancers] > >- break >- except: >+ # Then, add any new ones to the end of the local list. >+ modified = modified + [x for x in response_balancers if x not in modified] >+ >+ # If any changes have been made, save to the listing file. >+ if modified != cds_balancers: >+ f = open(cds_list_filename, 'w') >+ f.write('\n'.join(modified)) >+ f.close() >+ >+ break >+ >+ except urlgrabber.grabber.URLGrabError, e: >+ conduit.info(2, "Could not retrieve members list from " + lb) >+ conduit.info(2, " Reason= " + str(e)) > pass > > for repo in rhui_repos: >@@ -90,3 +125,7 @@ def postreposetup_hook(conduit): > # the good one > path = urlparse.urlparse(repo.mirrorlist)[2] > repo.mirrorlist = 'https://%s%s' % (up_lb, path) >+ >+ # FIXME: Hack to override proxy configuration of repo object: >+ repo._proxy_dict = ugopts.get("proxies", None) >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 873657
:
639349
| 684895