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

[seport] fix the processing of a list of integers as the ports spec #58637

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
2 participants
@das7pad
Copy link
Contributor

commented Jul 2, 2019

SUMMARY

The seport module does not enforce an element type for the ports and the example shows a mixed usage of strings and integers as a list item.

Using an integer as port breaks the port handling in this module and the handling in the seobject package on the node.

Casting every port as string fixes the handling.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

seport

ADDITIONAL INFORMATION
# traceback in this module
{"changed": false, "module_stderr": "Shared connection to SNIP closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1562077098.42-100783222996536/AnsiballZ_seport.py\", line 125, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1562077098.42-100783222996536/AnsiballZ_seport.py\", line 117, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1562077098.42-100783222996536/AnsiballZ_seport.py\", line 54, in invoke_module\r\n    imp.load_module('__main__', mod, module, MOD_DESC)\r\n  File \"/tmp/ansible_seport_payload_YvGtLh/__main__.py\", line 307, in <module>\r\n  File \"/tmp/ansible_seport_payload_YvGtLh/__main__.py\", line 297, in main\r\n  File \"/tmp/ansible_seport_payload_YvGtLh/__main__.py\", line 206, in semanage_port_add\r\n  File \"/tmp/ansible_seport_payload_YvGtLh/__main__.py\", line 159, in semanage_port_get_type\r\nAttributeError: 'int' object has no attribute 'split'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

# traceback in seobject, string handling fixed in the semanage_port_get_type function
{"changed": false, "module_stderr": "Shared connection to SNIP closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1562077932.73-31177858006091/AnsiballZ_seport.py\", line 125, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1562077932.73-31177858006091/AnsiballZ_seport.py\", line 117, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1562077932.73-31177858006091/AnsiballZ_seport.py\", line 54, in invoke_module\r\n    imp.load_module('__main__', mod, module, MOD_DESC)\r\n  File \"/tmp/ansible_seport_payload_Iz0NRY/__main__.py\", line 310, in <module>\r\n  File \"/tmp/ansible_seport_payload_Iz0NRY/__main__.py\", line 300, in main\r\n  File \"/tmp/ansible_seport_payload_Iz0NRY/__main__.py\", line 213, in semanage_port_add\r\n  File \"/usr/lib64/python2.7/site-packages/seobject/__init__.py\", line 1200, in modify\r\n    self.__modify(port, proto, serange, setype)\r\n  File \"/usr/lib64/python2.7/site-packages/seobject/__init__.py\", line 1168, in __modify\r\n    (k, proto_d, low, high) = self.__genkey(port, proto)\r\n  File \"/usr/lib64/python2.7/site-packages/seobject/__init__.py\", line 1074, in __genkey\r\n    ports = port.split(\"-\")\r\nAttributeError: 'int' object has no attribute 'split'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
[seport] fix the processing of a list of integers as the ports spec
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jul 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.