pulp/nectar

Add the ability to explicitly unset proxy_url in inherited configs

Closed this issue · 3 comments

I am running Katello and for nearly all of my repos I want to have a proxy configured. However I am mirroring some repos from internal sources. The repository config seems to inherit from nectar defaults so you can actually override proxy_url on specific repos. But setting proxy_url to None, or "" doesn't work as expected. Because config.proxy_url=""==False in python and when I tried "None" it correctly becomes the string "None" and there is no proxy server named "None" in our network.

I found a workaround, a gross workaround, I manually edited the installed downloaders/threaded.py.

--- theirs/threaded.py  2017-10-12 00:48:19.658019171 +0000
+++ mine/threaded.py    2017-10-12 00:48:37.947019171 +0000
@@ -149,7 +149,7 @@
         #
         # Annoyingly, although the config is called 'proxy_url', the port and basic auth
         # credentials are defined separately, so we have to build the url.
-        if config.proxy_url and config.proxy_port:
+        if config.proxy_url and config.proxy_url != '_none_' and config.proxy_port:
             parsed_url = urllib3_url.parse_url(config.proxy_url)
             proxy_auth = None
             if config.proxy_username and config.proxy_password:

I would submit it as a merge request but I suspect my patch is a bit myopic.

I chose the value _none_ because that's what yum uses and it made sense to me and might make sense to others. I'm not married to it. Just a thought.

@alanwevans, thank you for bringing this up, could you open an issue in our tracker? because this is the place where we track, plan, discuss, triage all issues? https://pulp.plan.io/issues/new
thank you.

Sorry, I saw your comment and promptly forgot to create the issue over there. I have now.
https://pulp.plan.io/issues/3105