fix the variable collision issue in downstream tests (#364)
* fix the variable collision issue * make output format in such a way that it returns a dict * changes * changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * revert back changes * changes * changes * fix the error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add dict construct --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>pull/358/head
parent
540e0d8963
commit
1df7af5ab2
|
@ -44,7 +44,7 @@ def from_xml(data, engine):
|
|||
if not HAS_XMLTODICT:
|
||||
_raise_error("Missing required library xmltodict")
|
||||
try:
|
||||
res = xmltodict.parse(data)
|
||||
res = xmltodict.parse(data, dict_constructor=dict)
|
||||
except Exception:
|
||||
_raise_error("Input Xml is not valid")
|
||||
return res
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
|
||||
- name: Integration tests with and without default engine as xmltodict and
|
||||
ansible.builtin.assert:
|
||||
that: "{{ output == item.test }}"
|
||||
that: "{{ output == test_item.test }}"
|
||||
loop:
|
||||
- test: "{{ data | ansible.utils.from_xml() }}"
|
||||
- test: "{{ data | ansible.utils.from_xml('xmltodict') }}"
|
||||
loop_control:
|
||||
loop_var: test_item
|
||||
|
||||
- name: Setup invalid xml as input to ansible.utils.from_xml.
|
||||
ansible.builtin.set_fact:
|
||||
|
|
Loading…
Reference in New Issue