Skip to content

junos_get_facts raises exception when used with savedir option #223

@stoffi92

Description

@stoffi92

It seems that the commit 1c993cd in junos_get_facts introduces a problem. junos_get_facts throws an exception when used with the savedir option. The exception that we see is:

An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_gmEUYy/ansible_module_junos_get_facts.py", line 268, in
main()
File "/tmp/ansible_gmEUYy/ansible_module_junos_get_facts.py", line 216, in main
json.dump(dev.facts, factfile)
File "/usr/lib64/python2.7/json/init.py", line 189, in dump
for chunk in iterable:
File "/usr/lib64/python2.7/json/encoder.py", line 442, in _iterencode
o = _default(o)
File "/usr/lib/python2.7/site-packages/jnpr/junos/factory/to_json.py", line 57, in default
obj = super(PyEzJSONEncoder, self).default(obj)
File "/usr/lib64/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")

This may be related with the fact that the new m_results['facts'] variable has been introduced but the json dump is still using json.dump(dev.facts , factfile). See #210 and commit 1c993cd

Christoph

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions