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

add ignore_errors for pyang in get action #69

Closed jksmth closed 2 years ago

jksmth commented 2 years ago
SUMMARY

Add option to ignore errors/warning produced by pyang when converting yang to other formats, e.g. xsl.

ISSUE TYPE
COMPONENT NAME

community.yang.get

ADDITIONAL INFORMATION

Any errors produced by the pyang formatting will cause pyang's jsonxsl.py module to raise an exception https://github.com/mbj4668/pyang/blob/de7a4be61fa699929a31a404e1b696c57737fa5f/pyang/plugins/jsonxsl.py#L73, including warnings about modules that are implicitly included not being used, etc. Passing --ignore-errors to the pyang exec allows the translator to complete successfully.

TASK [get interface configuration in json format] **************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: JSONXSL plugin needs a valid module
fatal: [router-1]: FAILED! => {"changed": false, "msg": "Error while generating (xsl) intermediate file: /ansible/files/yang/ietf-inet-types.yang:6: warning: imported module \"tailf-common\" not used\nJSONXSL plugin needs a valid module\n"}

PLAY RECAP *********************************************************************************************************************************
router-1                    : ok=1    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0