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

Fix checksum file parsing in get_url #53685

Merged
merged 3 commits into from
Mar 12, 2019
Merged

Fix checksum file parsing in get_url #53685

merged 3 commits into from
Mar 12, 2019

Conversation

sivel
Copy link
Member

@sivel sivel commented Mar 12, 2019

SUMMARY

Fix checksum file parsing in get_url. Fixes #48790

Due to over zealous exception catching, we were obscuring the real error. The real error was the result of assuming that every line in a checksum file could be split into exactly 2 parts.

This PR:

  1. ensures that the split results in 2 parts before trying to add to the dict.
  2. Wraps the minimal number of lines to detect the specific exception the code is concerned with
  3. Uses a new variable checksum_map instead of re-using a variable lines that was converted from a list to a dict
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/modules/net_tools/basic/get_url.py

ADDITIONAL INFORMATION

@sivel
Copy link
Member Author

sivel commented Mar 12, 2019

It is likely beneficial to view this PR with whitespace changes hidden:

https://github.com/ansible/ansible/pull/53685/files?diff=unified&w=1

@ansibot
Copy link
Contributor

ansibot commented Mar 12, 2019

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. net_tools Net-tools category support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Mar 12, 2019
samdoran and others added 2 commits March 12, 2019 11:17
Co-Authored-By: sivel <matt@sivel.net>
@sivel sivel merged commit 77217fd into ansible:devel Mar 12, 2019
sivel added a commit to sivel/ansible that referenced this pull request Mar 12, 2019
* Fix checksum file parsing. Fixes ansible#48790

* guard invalid int conversion

Co-Authored-By: sivel <matt@sivel.net>

* Remove extra newline.
(cherry picked from commit 77217fd)

Co-authored-by: Matt Martz <matt@sivel.net>
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Mar 13, 2019
abadger pushed a commit that referenced this pull request Mar 18, 2019
* [stable-2.7] Fix checksum file parsing in get_url (#53685)

* Fix checksum file parsing. Fixes #48790

* guard invalid int conversion

Co-Authored-By: sivel <matt@sivel.net>

* Remove extra newline.
(cherry picked from commit 77217fd)

Co-authored-by: Matt Martz <matt@sivel.net>

* Remove use of undefined variable
@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.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. net_tools Net-tools category support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_url does not handle CHECKSUMS files from URL unless the file contains a single checksum
3 participants