* add test of yum with proxy * Properly handle unauthenticated yum proxy config Fixes #51548 * shell executable is bash
This commit is contained in:
parent
d7fd4d0550
commit
c2a409a9e0
2 changed files with 28 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -17,6 +17,12 @@
|
|||
line: "proxy=http://127.0.0.1:8888"
|
||||
state: present
|
||||
|
||||
- name: clear proxy logs
|
||||
shell: ': > /var/log/tinyproxy/tinyproxy.log'
|
||||
changed_when: false
|
||||
args:
|
||||
executable: /usr/bin/bash
|
||||
|
||||
- name: install ninvaders with unauthenticated proxy
|
||||
yum:
|
||||
name: 'https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/yum/ninvaders-0.1.1-18.el7.x86_64.rpm'
|
||||
|
@ -29,6 +35,9 @@
|
|||
- "'msg' in yum_proxy_result"
|
||||
- "'rc' in yum_proxy_result"
|
||||
|
||||
- name: check that it install via unauthenticated proxy
|
||||
command: grep -q Request /var/log/tinyproxy/tinyproxy.log
|
||||
|
||||
- name: uninstall ninvaders with unauthenticated proxy
|
||||
yum:
|
||||
name: ninvaders
|
||||
|
@ -67,6 +76,12 @@
|
|||
line: "proxy=http://1testuser:1testpassword@127.0.0.1:8888"
|
||||
state: present
|
||||
|
||||
- name: clear proxy logs
|
||||
shell: ': > /var/log/tinyproxy/tinyproxy.log'
|
||||
changed_when: false
|
||||
args:
|
||||
executable: /usr/bin/bash
|
||||
|
||||
- name: install ninvaders with authenticated proxy
|
||||
yum:
|
||||
name: 'https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/yum/ninvaders-0.1.1-18.el7.x86_64.rpm'
|
||||
|
@ -79,6 +94,9 @@
|
|||
- "'msg' in yum_proxy_result"
|
||||
- "'rc' in yum_proxy_result"
|
||||
|
||||
- name: check that it install via authenticated proxy
|
||||
command: grep -q Request /var/log/tinyproxy/tinyproxy.log
|
||||
|
||||
- name: uninstall ninvaders with authenticated proxy
|
||||
yum:
|
||||
name: ninvaders
|
||||
|
@ -108,6 +126,12 @@
|
|||
line: "proxy_password=1testpassword"
|
||||
state: present
|
||||
|
||||
- name: clear proxy logs
|
||||
shell: ': > /var/log/tinyproxy/tinyproxy.log'
|
||||
changed_when: false
|
||||
args:
|
||||
executable: /usr/bin/bash
|
||||
|
||||
- name: install ninvaders with proxy, proxy_username, and proxy_password config in yum.conf
|
||||
yum:
|
||||
name: 'https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/yum/ninvaders-0.1.1-18.el7.x86_64.rpm'
|
||||
|
@ -120,6 +144,9 @@
|
|||
- "'msg' in yum_proxy_result"
|
||||
- "'rc' in yum_proxy_result"
|
||||
|
||||
- name: check that it install via proxy with proxy_username, proxy_password config in yum.conf
|
||||
command: grep -q Request /var/log/tinyproxy/tinyproxy.log
|
||||
|
||||
always:
|
||||
#cleanup
|
||||
- name: uninstall tinyproxy
|
||||
|
|
Loading…
Reference in a new issue