mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
* 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
|
# setting system proxy environment and saving old, if exists
|
||||||
my = self.yum_base()
|
my = self.yum_base()
|
||||||
namepass = ""
|
namepass = ""
|
||||||
proxy_url = ""
|
|
||||||
scheme = ["http", "https"]
|
scheme = ["http", "https"]
|
||||||
old_proxy_env = [os.getenv("http_proxy"), os.getenv("https_proxy")]
|
old_proxy_env = [os.getenv("http_proxy"), os.getenv("https_proxy")]
|
||||||
try:
|
try:
|
||||||
|
@ -726,10 +725,7 @@ class YumModule(YumDnf):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
for item in scheme:
|
for item in scheme:
|
||||||
os.environ[item + "_proxy"] = re.sub(
|
os.environ[item + "_proxy"] = my.conf.proxy
|
||||||
r"(http://)",
|
|
||||||
r"\g<1>", proxy_url
|
|
||||||
)
|
|
||||||
yield
|
yield
|
||||||
except yum.Errors.YumBaseError:
|
except yum.Errors.YumBaseError:
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
line: "proxy=http://127.0.0.1:8888"
|
line: "proxy=http://127.0.0.1:8888"
|
||||||
state: present
|
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
|
- name: install ninvaders with unauthenticated proxy
|
||||||
yum:
|
yum:
|
||||||
name: 'https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/yum/ninvaders-0.1.1-18.el7.x86_64.rpm'
|
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"
|
- "'msg' in yum_proxy_result"
|
||||||
- "'rc' 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
|
- name: uninstall ninvaders with unauthenticated proxy
|
||||||
yum:
|
yum:
|
||||||
name: ninvaders
|
name: ninvaders
|
||||||
|
@ -67,6 +76,12 @@
|
||||||
line: "proxy=http://1testuser:1testpassword@127.0.0.1:8888"
|
line: "proxy=http://1testuser:1testpassword@127.0.0.1:8888"
|
||||||
state: present
|
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
|
- name: install ninvaders with authenticated proxy
|
||||||
yum:
|
yum:
|
||||||
name: 'https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/yum/ninvaders-0.1.1-18.el7.x86_64.rpm'
|
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"
|
- "'msg' in yum_proxy_result"
|
||||||
- "'rc' 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
|
- name: uninstall ninvaders with authenticated proxy
|
||||||
yum:
|
yum:
|
||||||
name: ninvaders
|
name: ninvaders
|
||||||
|
@ -108,6 +126,12 @@
|
||||||
line: "proxy_password=1testpassword"
|
line: "proxy_password=1testpassword"
|
||||||
state: present
|
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
|
- name: install ninvaders with proxy, proxy_username, and proxy_password config in yum.conf
|
||||||
yum:
|
yum:
|
||||||
name: 'https://s3.amazonaws.com/ansible-ci-files/test/integration/targets/yum/ninvaders-0.1.1-18.el7.x86_64.rpm'
|
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"
|
- "'msg' in yum_proxy_result"
|
||||||
- "'rc' 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:
|
always:
|
||||||
#cleanup
|
#cleanup
|
||||||
- name: uninstall tinyproxy
|
- name: uninstall tinyproxy
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue