Fix: Yum module does not use proxy when username is not set #51548 (#51994)

* add test of yum with proxy

* Properly handle unauthenticated yum proxy config

Fixes #51548

* shell executable is bash
This commit is contained in:
おすし 2019-02-14 04:10:47 +09:00 committed by ansibot
commit c2a409a9e0
2 changed files with 28 additions and 5 deletions

View file

@ -703,7 +703,6 @@ class YumModule(YumDnf):
# setting system proxy environment and saving old, if exists
my = self.yum_base()
namepass = ""
proxy_url = ""
scheme = ["http", "https"]
old_proxy_env = [os.getenv("http_proxy"), os.getenv("https_proxy")]
try:
@ -726,10 +725,7 @@ class YumModule(YumDnf):
)
else:
for item in scheme:
os.environ[item + "_proxy"] = re.sub(
r"(http://)",
r"\g<1>", proxy_url
)
os.environ[item + "_proxy"] = my.conf.proxy
yield
except yum.Errors.YumBaseError:
raise