From 7b9d7e6b5c1693e4c2cd7bf993843a5fac1d79f2 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Thu, 23 May 2019 16:41:18 +0200 Subject: [PATCH] yum: handle "_none_" value for proxy (#56725) * yum: handle "_none_" value for proxy Fixes #56538 * Fix sanity check --- changelogs/fragments/56538-yum-handle-proxy-conf.yaml | 2 ++ lib/ansible/modules/packaging/os/yum.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/56538-yum-handle-proxy-conf.yaml diff --git a/changelogs/fragments/56538-yum-handle-proxy-conf.yaml b/changelogs/fragments/56538-yum-handle-proxy-conf.yaml new file mode 100644 index 0000000000..78a6c3017c --- /dev/null +++ b/changelogs/fragments/56538-yum-handle-proxy-conf.yaml @@ -0,0 +1,2 @@ +bugfixes: + - 'yum - handle special "_none_" value for proxy in yum.conf and .repo files (https://github.com/ansible/ansible/issues/56538)' diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index 107bd3f65d..6d02a6dba6 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -728,7 +728,8 @@ class YumModule(YumDnf): scheme = ["http", "https"] old_proxy_env = [os.getenv("http_proxy"), os.getenv("https_proxy")] try: - if my.conf.proxy: + # "_none_" is a special value to disable proxy in yum.conf/*.repo + if my.conf.proxy and my.conf.proxy not in ("_none_",): if my.conf.proxy_username: namepass = namepass + my.conf.proxy_username proxy_url = my.conf.proxy