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
TASK [redhat.runtimes_common.xml] *******************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: Argument must be bytes or unicode, got 'int'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/cmaso/.ansible/tmp/ansible-tmp-1728972733.6213477-1779995-35690117152941/AnsiballZ_xml.py\", line 107, in <module>\n _ansiballz_main()\n File \"/home/cmaso/.ansible/tmp/ansible-tmp-1728972733.6213477-1779995-35690117152941/AnsiballZ_xml.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/cmaso/.ansible/tmp/ansible-tmp-1728972733.6213477-1779995-35690117152941/AnsiballZ_xml.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.redhat.runtimes_common.plugins.modules.xml', init_globals=dict(_module_fqn='ansible_collections.redhat.runtimes_common.plugins.modules.xml', _modlib_path=modlib_path),\n File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_redhat.runtimes_common.xml_payload_i_tmacpd/ansible_redhat.runtimes_common.xml_payload.zip/ansible_collections/redhat/runtimes_common/plugins/modules/xml.py\", line 1018, in <module>\n File \"/tmp/ansible_redhat.runtimes_common.xml_payload_i_tmacpd/ansible_redhat.runtimes_common.xml_payload.zip/ansible_collections/redhat/runtimes_common/plugins/modules/xml.py\", line 1004, in main\n File \"/tmp/ansible_redhat.runtimes_common.xml_payload_i_tmacpd/ansible_redhat.runtimes_common.xml_payload.zip/ansible_collections/redhat/runtimes_common/plugins/modules/xml.py\", line 708, in set_target\n File \"/tmp/ansible_redhat.runtimes_common.xml_payload_i_tmacpd/ansible_redhat.runtimes_common.xml_payload.zip/ansible_collections/redhat/runtimes_common/plugins/modules/xml.py\", line 694, in set_target_inner\n File \"src/lxml/etree.pyx\", line 1024, in lxml.etree._Element.text.__set__\n File \"src/lxml/apihelpers.pxi\", line 748, in lxml.etree._setNodeText\n File \"src/lxml/apihelpers.pxi\", line 736, in lxml.etree._createTextNode\n File \"src/lxml/apihelpers.pxi\", line 1539, in lxml.etree._utf8\nTypeError: Argument must be bytes or unicode, got 'int'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
Not totally positive if that can/should be treated as a bug (module docu says that value must be a string), maybe it should be reported as a feature request?
@cmasopust you need to explicitly convert myval to a string before passing it to the value parameter.
The value: "{{ myval | string }}" ensures that the integer 255 is converted to the string "255".
SUMMARY
Setting
jinja2_native=True
in ansible.cfg and run the following playbook:results in:
Not totally positive if that can/should be treated as a bug (module docu says that
value
must be a string), maybe it should be reported as a feature request?ISSUE TYPE
ANSIBLE VERSION
COLLECTION VERSION
EXPECTED RESULTS
Module
xml
may be extended to allow more basic types (e.g. int, boolean, etc) for parametervalue
.ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: