Hello Christian: I reviewed your patch and made few changes to make it a bit more concise and applied to master. Attached is the patch.
Thanks a lot for your contribution. ~ Prad. ----- Original Message ----- From: "Christian Masopust" <[email protected]> To: "Pradeep Kilambi" <[email protected]>, "Mike McCune" <[email protected]> Cc: "[email protected]" <[email protected]> Sent: Friday, January 21, 2011 12:56:14 PM Subject: AW: [Pulp-list] PULP - newby question.... pulp behind a proxy Hello again, first I've to appologize.... I'm not a real python-programmer :-)) anyway, according to your answers and descriptions I was able to patch my pulp-installation and it's currently downloading the configured yum-repo via our proxy !! and btw.... I'm running pulp on one of our RHEL6 systems :-) Thanks a lot, Christian Here's the patch I made: [root@atvies00rx tmp]# diff -Naur pulp-0.0.129/ pulp-yumproxy/ diff -Naur pulp-0.0.129/etc/pulp/pulp.conf pulp-yumproxy/etc/pulp/pulp.conf --- pulp-0.0.129/etc/pulp/pulp.conf 2011-01-20 13:09:43.853821069 +0100 +++ pulp-yumproxy/etc/pulp/pulp.conf 2011-01-21 18:52:18.181657257 +0100 @@ -80,7 +80,11 @@ # Integer to specify how many old packages to keep. # Only used if 'removeold' is set to True num_old_pkgs_keep: 2 - +# proxy-settings (see bug# 671468) +# proxy_url: +# proxy_port: +# proxy_user: +# proxy_pass: [repos] content_url: https://cdn.redhat.com/ diff -Naur pulp-0.0.129/src/pulp/server/api/repo_sync.py pulp-yumproxy/src/pulp/server/api/repo_sync.py --- pulp-0.0.129/src/pulp/server/api/repo_sync.py 2011-01-20 13:09:43.879032864 +0100 +++ pulp-yumproxy/src/pulp/server/api/repo_sync.py 2011-01-21 18:49:05.869783289 +0100 @@ -363,6 +363,7 @@ self.yum_repo_grinder = None def sync(self, repo, repo_source, skip_dict={}, progress_callback=None): + proxy_url = proxy_port = proxy_user = proxy_pass = None cacert = clicert = clikey = None if repo['ca'] and repo['cert'] and repo['key']: cacert = repo['ca'].encode('utf8') @@ -372,9 +373,19 @@ num_threads = config.config.getint('yum', 'threads') remove_old = config.config.getboolean('yum', 'remove_old_packages') num_old_pkgs_keep = config.config.getint('yum', 'num_old_pkgs_keep') + if (config.config.has_option('yum', 'proxy_url')): + proxy_url = config.config.get('yum', 'proxy_url') + if (config.config.has_option('yum', 'proxy_port')): + proxy_port = config.config.getint('yum', 'proxy_port') + if (config.config.has_option('yum', 'proxy_user')): + proxy_user = config.config.get('yum', 'proxy_user') + if (config.config.has_option('yum', 'proxy_pass')): + proxy_pass = config.config.get('yum', 'proxy_pass') self.yum_repo_grinder = YumRepoGrinder('', repo_source['url'].encode('ascii', 'ignore'), num_threads, cacert=cacert, clicert=clicert, clikey=clikey, + proxy_url=proxy_url, proxy_port=proxy_port, + proxy_user=proxy_user, proxy_pass=proxy_pass, packages_location=pulp.server.util.top_package_location(), remove_old=remove_old, numOldPackages=num_old_pkgs_keep, skip=skip_dict) relative_path = repo['relative_path'] -----Ursprüngliche Nachricht----- Von: Pradeep Kilambi [mailto:[email protected]] Gesendet: Freitag, 21. Jänner 2011 17:07 An: Mike McCune Cc: [email protected]; Masopust, Christian Betreff: Re: [Pulp-list] PULP - newby question.... pulp behind a proxy Yea we dont have support for pulp behind proxy yet. But as John said, grinder supports it so you can download the bits behind a proxy. ~ Prad ----- Original Message ----- From: "Mike McCune" <[email protected]> To: "Christian Masopust" <[email protected]> Cc: "[email protected]" <[email protected]> Sent: Friday, January 21, 2011 10:15:16 AM Subject: Re: [Pulp-list] PULP - newby question.... pulp behind a proxy On 01/20/2011 08:11 AM, Masopust, Christian wrote: > tried google, searched the mail-archive... failed :-)) > what to configure if running pulp behind a proxy (http) ?? > thanks a lot, > christian > I don't think our client yet supports connecting through a http proxy. I don't think it would be all that hard to add but I don't think it yet can do this. Prad, correct me if I'm wrong ... Mike -- Mike McCune mmccune AT redhat.com Red Hat Engineering | Portland, OR Systems Management | 650.254.4248 _______________________________________________ Pulp-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/pulp-list -- -- Pradeep Kilambi Red Hat Systems Management [email protected] Phone: +1 919 754 4285 RHCE/RHCDS # 805008680430554 -- -- Pradeep Kilambi Red Hat Systems Management [email protected] Phone: +1 919 754 4285 RHCE/RHCDS # 805008680430554
diff --git a/etc/pulp/pulp.conf b/etc/pulp/pulp.conf index 2a38d5f..c02d373 100755 --- a/etc/pulp/pulp.conf +++ b/etc/pulp/pulp.conf @@ -80,7 +80,11 @@ remove_old_packages: false # Integer to specify how many old packages to keep. # Only used if 'removeold' is set to True num_old_pkgs_keep: 2 - +# Uncomment the below section with appropriate values for proxy configuration +# proxy_url: +# proxy_port: +# proxy_user: +# proxy_pass: [repos] content_url: https://cdn.redhat.com/ diff --git a/src/pulp/server/api/repo_sync.py b/src/pulp/server/api/repo_sync.py index cc2940b..4fe43c4 100644 --- a/src/pulp/server/api/repo_sync.py +++ b/src/pulp/server/api/repo_sync.py @@ -409,11 +409,18 @@ class YumSynchronizer(BaseSynchronizer): num_threads = config.config.getint('yum', 'threads') remove_old = config.config.getboolean('yum', 'remove_old_packages') num_old_pkgs_keep = config.config.getint('yum', 'num_old_pkgs_keep') + # check for proxy settings + proxy_url = proxy_port = proxy_user = proxy_pass = None + for proxy_cfg in ['proxy_url', 'proxy_port', 'proxy_user', 'proxy_pass']: + if (config.config.has_option('yum', proxy_cfg)): + vars()[proxy_cfg] = config.config.get('yum', proxy_cfg) + self.yum_repo_grinder = YumRepoGrinder('', repo_source['url'].encode('ascii', 'ignore'), - num_threads, cacert=cacert, clicert=clicert, - clikey=clikey, + num_threads, cacert=cacert, clicert=clicert, clikey=clikey, packages_location=pulp.server.util.top_package_location(), - remove_old=remove_old, numOldPackages=num_old_pkgs_keep, skip=skip_dict) + remove_old=remove_old, numOldPackages=num_old_pkgs_keep, skip=skip_dict, + proxy_url=proxy_url, proxy_port=proxy_port, + proxy_user=proxy_user, proxy_pass=proxy_pass) relative_path = repo['relative_path'] if relative_path: store_path = "%s/%s" % (pulp.server.util.top_repos_location(), relative_path)
_______________________________________________ Pulp-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/pulp-list
