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 firewalld module failing on missing protocol. #50242

Merged

Conversation

ericzolf
Copy link
Contributor

SUMMARY

Under Python 3.7 at least, the split of the port field fails
ungracefully if there is no slash. The fix also addresses the
case of an empty protocol after the slash.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

firewalld

ADDITIONAL INFORMATION

if giving the port as 12345 (without e.g. /tcp) the following error would be spit out:

  import imp
Traceback (most recent call last):
  File \"/home/myuser/.ansible/tmp/ansible-tmp-1545383532.7414896-43532312250195/AnsiballZ_firewalld.py\", line 113, in <module>
    _ansiballz_main()
  File \"/home/myuser/.ansible/tmp/ansible-tmp-1545383532.7414896-43532312250195/AnsiballZ_firewalld.py\", line 105, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File \"/home/myuser/.ansible/tmp/ansible-tmp-1545383532.7414896-43532312250195/AnsiballZ_firewalld.py\", line 48, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File \"/usr/lib64/python3.7/imp.py\", line 234, in load_module
    return load_source(name, filename, file)
  File \"/usr/lib64/python3.7/imp.py\", line 169, in load_source
    module = _exec(spec, sys.modules[name])
  File \"<frozen importlib._bootstrap>\", line 630, in _exec
  File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module
  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed
  File \"/tmp/ansible_firewalld_payload_6m_d8c8n/__main__.py\", line 715, in <module>
  File \"/tmp/ansible_firewalld_payload_6m_d8c8n/__main__.py\", line 570, in main
ValueError: not enough values to unpack (expected 2, got 1)

The fix also makes sure that an empty protocol e.g. 12345/ isn't accepted anymore.

Under Python 3.7 at least, the split of the port field fails
ungracefully if there is no slash. The fix also addresses the
case of an empty protocol after the slash.
@ansibot
Copy link
Contributor

ansibot commented Dec 21, 2018

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. python3 support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. labels Dec 21, 2018
@evgeni
Copy link
Contributor

evgeni commented Dec 21, 2018

👍 (but I have no review powers here)

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 29, 2018
@maxamillion maxamillion merged commit 69deb73 into ansible:devel Jan 2, 2019
@maxamillion
Copy link
Contributor

@ericzolf thank you for the fix!

maxamillion pushed a commit to maxamillion/ansible that referenced this pull request Jan 2, 2019
Under Python 3.7 at least, the split of the port field fails
ungracefully if there is no slash. The fix also addresses the
case of an empty protocol after the slash.

(cherry picked from commit 69deb73)
maxamillion added a commit to maxamillion/ansible that referenced this pull request Jan 2, 2019
Signed-off-by: Adam Miller <admiller@redhat.com>
ansibot pushed a commit that referenced this pull request Jan 2, 2019
Signed-off-by: Adam Miller <admiller@redhat.com>
maxamillion added a commit to maxamillion/ansible that referenced this pull request Jan 3, 2019
Signed-off-by: Adam Miller <admiller@redhat.com>
(cherry picked from commit b81a74f)
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Jan 4, 2019
abadger pushed a commit that referenced this pull request Jan 7, 2019
* Fix firewalld module failing on missing protocol. (#50242)

Under Python 3.7 at least, the split of the port field fails
ungracefully if there is no slash. The fix also addresses the
case of an empty protocol after the slash.

(cherry picked from commit 69deb73)

* add changelog for #50242 (#50480)

Signed-off-by: Adam Miller <admiller@redhat.com>
(cherry picked from commit b81a74f)
kbreit pushed a commit to kbreit/ansible that referenced this pull request Jan 11, 2019
Under Python 3.7 at least, the split of the port field fails
ungracefully if there is no slash. The fix also addresses the
case of an empty protocol after the slash.
kbreit pushed a commit to kbreit/ansible that referenced this pull request Jan 11, 2019
Signed-off-by: Adam Miller <admiller@redhat.com>
@ansible ansible locked and limited conversation to collaborators Jul 22, 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. community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. python3 stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants