Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yum module does not use proxy when username is not set #51548

Closed
1kaw opened this issue Jan 31, 2019 · 2 comments · Fixed by #51915
Closed

Yum module does not use proxy when username is not set #51548

1kaw opened this issue Jan 31, 2019 · 2 comments · Fixed by #51915
Assignees
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@1kaw
Copy link
Contributor

1kaw commented Jan 31, 2019

SUMMARY

See also: #18979 (comment)

In installing remote RPM using Yum module,
Yum module uses proxy only when proxy with authentication is set in yum.conf. and proxy is not used when proxy with no authentication is set.

The code causing this bug is shown below:

if my.conf.proxy:
if my.conf.proxy_username:
namepass = namepass + my.conf.proxy_username
proxy_url = my.conf.proxy
if my.conf.proxy_password:
namepass = namepass + ":" + my.conf.proxy_password
elif '@' in my.conf.proxy:
namepass = my.conf.proxy.split('@')[0].split('//')[-1]
proxy_url = my.conf.proxy.replace("{0}@".format(namepass), "")
if namepass:
namepass = namepass + '@'
for item in scheme:
os.environ[item + "_proxy"] = re.sub(
r"(http://)",
r"\g<1>" + namepass, proxy_url
)
yield

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Yum module

ANSIBLE VERSION
  • 2.7
  • devel branch
CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

STEPS TO REPRODUCE
  1. install and start proxy (without basic authentication)
  2. write proxy=http://myproxy:8888 in yum.conf
  3. try to install remote rpm using yum module
- yum:
    name: http://www.yum-repository.com/remote.rpm
EXPECTED RESULTS

yum module downloads the rpm via my proxy.

ACTUAL RESULTS

yum module does NOT use my proxy.

@ansibot
Copy link
Contributor

ansibot commented Jan 31, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jan 31, 2019

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jan 31, 2019
@maxamillion maxamillion self-assigned this Jan 31, 2019
@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Jan 31, 2019
maxamillion added a commit to maxamillion/ansible that referenced this issue Feb 7, 2019
Fixes ansible#51548

Signed-off-by: Adam Miller <admiller@redhat.com>
ansibot pushed a commit that referenced this issue Feb 9, 2019
Fixes #51548

Signed-off-by: Adam Miller <admiller@redhat.com>
1kaw added a commit to 1kaw/ansible that referenced this issue Feb 10, 2019
ansibot pushed a commit that referenced this issue Feb 13, 2019
…51994)

* add test of yum with proxy

* Properly handle unauthenticated yum proxy config

Fixes #51548

* shell executable is bash
1kaw pushed a commit to 1kaw/ansible that referenced this issue Feb 14, 2019
Fixes ansible#51548

Signed-off-by: Adam Miller <admiller@redhat.com>
(cherry picked from commit 2721ed2)
1kaw added a commit to 1kaw/ansible that referenced this issue Feb 14, 2019
…1548 (ansible#51994)

* add test of yum with proxy

* Properly handle unauthenticated yum proxy config

Fixes ansible#51548

* shell executable is bash

(cherry picked from commit c2a409a)
abadger pushed a commit that referenced this issue Feb 14, 2019
…#52245)

* Properly handle unauthenticated yum proxy config (#51915)

Fixes #51548

Signed-off-by: Adam Miller <admiller@redhat.com>
(cherry picked from commit 2721ed2)

* 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

(cherry picked from commit c2a409a)
@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants