You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When binding ports to an IPv6 address for a container, the IPv6 address has to be in [square brackets]. If not, it only checks whether there are one, two or three parts split by colons, and fails to catch any remaining cases which would indicate improper handling. Instead, the module fails with UnboundLocalError: local variable 'port_binds' referenced before assignment where it should tell the user to put IPv6 addresses in square brackets.
Module fails with helpful message that the string describing the port binding is malformed and if the user meant to specify an IPv6 address, it should be put in square brackets.
ACTUAL RESULTS
Module fails with UnboundLocalError: local variable 'port_binds' referenced before assignment.
$ ansible-playbook -i inventory.yaml reverse-proxy.yml --diff
PLAY [all] ************************************************************************************************************
TASK [Gathering Facts] ************************************************************************************************
ok: [pihole]
TASK [Start/Update nginx-proxy container] *****************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: UnboundLocalError: local variable 'port_binds' referenced before assignment
fatal: [pihole]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 107, in <module>\n File \"<stdin>\", line 99, in _ansiballz_main\n File \"<stdin>\", line 47, in invoke_module\n File \"/usr/lib/python3.9/runpy.py\", line 210, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.9/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_docker_container_payload_jrqvzgva/ansible_docker_container_payload.zip/ansible/modules/docker_container.py\", line 3667, in <module>\n File \"/tmp/ansible_docker_container_payload_jrqvzgva/ansible_docker_container_payload.zip/ansible/modules/docker_container.py\", line 3656, in main\n File \"/tmp/ansible_docker_container_payload_jrqvzgva/ansible_docker_container_payload.zip/ansible/modules/docker_container.py\", line 2813, in __init__\n File \"/tmp/ansible_docker_container_payload_jrqvzgva/ansible_docker_container_payload.zip/ansible/modules/docker_container.py\", line 1444, in __init__\n File \"/tmp/ansible_docker_container_payload_jrqvzgva/ansible_docker_container_payload.zip/ansible/modules/docker_container.py\", line 1848, in _parse_publish_ports\nUnboundLocalError: local variable 'port_binds' referenced before assignment\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
PLAY RECAP ************************************************************************************************************
pihole : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
$
The text was updated successfully, but these errors were encountered:
SUMMARY
When binding ports to an IPv6 address for a container, the IPv6 address has to be in [square brackets]. If not, it only checks whether there are one, two or three parts split by colons, and fails to catch any remaining cases which would indicate improper handling. Instead, the module fails with
UnboundLocalError: local variable 'port_binds' referenced before assignment
where it should tell the user to put IPv6 addresses in square brackets.ISSUE TYPE
COMPONENT NAME
docker_container.py
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
EXPECTED RESULTS
Module fails with helpful message that the string describing the port binding is malformed and if the user meant to specify an IPv6 address, it should be put in square brackets.
ACTUAL RESULTS
Module fails with
UnboundLocalError: local variable 'port_binds' referenced before assignment
.The text was updated successfully, but these errors were encountered: