ansible-collections / community.yang

Ansible Community Collection to support Yang in network devices.
GNU General Public License v3.0
10 stars 14 forks source link

Traceback when using configure #27

Closed cidrblock closed 4 years ago

cidrblock commented 4 years ago

When jsontoxml is called from configure, the user provided string has already been converted to a python object.

that object is passed to jsontoxml which thows the following error:

The full traceback is:
Traceback (most recent call last):
  File "/home/bthornto/github/yang/venv/lib64/python3.8/site-packages/ansible/executor/task_executor.py", line 147, in run
    res = self._execute()
  File "/home/bthornto/github/yang/venv/lib64/python3.8/site-packages/ansible/executor/task_executor.py", line 665, in _execute
    result = self._handler.run(task_vars=variables)
  File "/home/bthornto/github/yang/collections/ansible_collections/community/yang/plugins/action/configure.py", line 131, in run
    xml_data = tl.json_to_xml(json_config)
  File "/home/bthornto/github/yang/collections/ansible_collections/community/yang/plugins/module_utils/translator.py", line 111, in json_to_xml
    if not os.path.isfile(json_data):
  File "/usr/lib64/python3.8/genericpath.py", line 30, in isfile
    st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not dict
fatal: [eos101]: FAILED! => 
  msg: Unexpected failure during module execution.
  stdout: ''

This is the line if not os.path.isfile(json_data): <- it expects a string not an object