-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix compatibility when map is actually imap. #3350
Conversation
While I still have no idea why or how the `map` call is being swapped out while still running in python 2.7, this change will fix the following error, as well as improve py3 compatiblity: ``` An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: Value of unknown type: <type 'itertools.imap'>, <itertools.imap object at 0x7fdb35c4b110>, pysys.version_info(major=2, minor=7, micro=12, releaselevel='final', serial=0); from {'changed': True, 'command': ['get weight servers/server8888; enable server servers/server8888; set weight servers/server8888 0'], 'state_after': <itertools.imap object at 0x7fdb35c4b110>, 'invocation': {'module_args': {'shutdown_sessions': False, 'socket': '/var/run/haproxy/admin.sock', 'weight': '0', 'wait_interval': 5, 'wait_retries': 25, 'state': 'enabled', 'fail_on_not_found': False, 'host': 'server8888', 'wait': False, 'backend': 'servers'}}, 'output': ['0 (initial 1)'], 'state_before': <itertools.imap object at 0x7fdb35bd9fd0>}[state_after] fatal: [server0.staging.internal.encircleapp.com]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_z7IB5b/ansible_module_haproxy.py\", line 350, in <module>\n main()\n File \"/tmp/ansible_z7IB5b/ansible_module_haproxy.py\", line 345, in main\n ansible_haproxy.act()\n File \"/tmp/ansible_z7IB5b/ansible_module_haproxy.py\", line 317, in act\n self.module.exit_json(**self.command_results)\n File \"/tmp/ansible_z7IB5b/ansible_modlib.zip/ansible/module_utils/basic.py\", line 1799, in exit_json\n File \"/tmp/ansible_z7IB5b/ansible_modlib.zip/ansible/module_utils/basic.py\", line 388, in remove_values\n File \"/tmp/ansible_z7IB5b/ansible_modlib.zip/ansible/module_utils/basic.py\", line 388, in <genexpr>\n File \"/tmp/ansible_z7IB5b/ansible_modlib.zip/ansible/module_utils/basic.py\", line 399, in remove_values\nTypeError: Value of unknown type: <type 'itertools.imap'>, <itertools.imap object at 0x7fdb35c4b110>, pysys.version_info(major=2, minor=7, micro=12, releaselevel='final', serial=0); from {'changed': True, 'command': ['get weight servers/server8888; enable server servers/server8888; set weight servers/server8888 0'], 'state_after': <itertools.imap object at 0x7fdb35c4b110>, 'invocation': {'module_args': {'shutdown_sessions': False, 'socket': '/var/run/haproxy/admin.sock', 'weight': '0', 'wait_interval': 5, 'wait_retries': 25, 'state': 'enabled', 'fail_on_not_found': False, 'host': 'server8888', 'wait': False, 'backend': 'servers'}}, 'output': ['0 (initial 1)'], 'state_before': <itertools.imap object at 0x7fdb35bd9fd0>}[state_after]\n", "module_stdout": "", "msg": "MODULE FAILURE"} ```
+1 |
It's because map is being imported from the six module, which swaps it out with imap. If that helps any. I just got done tracking this problem myself. |
Thanks @christophebiocca. To the current maintainers, @ravibhure please review according to guidelines (http://docs.ansible.com/ansible/developing_modules.html#module-checklist) and comment with text 'shipit', 'needs_revision' or 'close_me' as appropriate. [This message brought to you by your friendly Ansibull-bot.] |
+1 shipit |
Same problem here, please merge it and include it in next bugfix release, it's very anoying :( |
Thanks again to @christophebiocca for this PR, and thanks @ravibhure for reviewing. Marking for inclusion. [This message brought to you by your friendly Ansibull-bot.] |
While I still have no idea why or how the `map` call is being swapped out while still running in python 2.7, this change will fix the following error, as well as improve py3 compatibility. (cherry picked from commit b23740e)
ISSUE TYPE
Bugfix Pull Request
COMPONENT NAME
haproxy
ANSIBLE VERSION
SUMMARY
2 functions return
map(some_stuff)
but those do not work whenmap
is actuallyimap
.While I still have no idea why or how the
map
call is being swapped out while still running in python 2.7, this change will fix the following error, as well as improve py3 compatiblity:Before:
After