ansible-junos-stdlib icon indicating copy to clipboard operation
ansible-junos-stdlib copied to clipboard

juniper.device.jsnapy - enhance callback option

Open jaakub opened this issue 1 year ago • 1 comments

Issue Type

  • Feature Idea

Module Name

juniper.device collection and Python libraries version

ansible [core 2.13.5]
  config file = /home/jakub/jsu-manager/ansible.cfg
  configured module search path = ['/home/jakub/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/jakub/jsu-manager/.jsu_manager_venv/lib/python3.8/site-packages/ansible
  ansible collection location = /home/jakub/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/jakub/jsu-manager/.jsu_manager_venv/bin/ansible
  python version = 3.8.0 (default, Dec  9 2021, 17:53:27) [GCC 8.4.0]
  jinja version = 3.1.2
  libyaml = True
ansible==6.5.0
ansible-core==2.13.5
bcrypt==4.0.1
cffi==1.15.1
colorama==0.4.5
configparser==5.3.0
cryptography==38.0.1
future==0.18.2
icdiff==1.9.1
Jinja2==3.1.2
jsnapy==1.3.7
junos-eznc @ git+https://github.com/Juniper/py-junos-eznc.git@c58107eb3677353801d7bed59101d7b2e5e55eac
jxmlease==1.0.3
lxml==4.9.1
MarkupSafe==2.1.1
ncclient==0.6.13
netaddr==0.8.0
packaging==21.3
paramiko==2.11.0
pkg_resources==0.0.0
pycparser==2.21
PyNaCl==1.5.0
pyparsing==3.0.9
pyserial==3.5
PyYAML==6.0
resolvelib==0.8.1
scp==0.14.4
six==1.16.0
transitions==0.9.0
ttp==0.9.1
xmltodict==0.13.0
yamlordereddictloader==0.4.0

OS / Environment

Summary

Currently, when JSNAPy test fails, the callback module doesn't return the 'human friendly err:' output (if that's available), and instead it always returns the default XML error such as :

Value of './task-protocol-replication-state' not 'no-diff' at '.' with {"./task-protocol-replication-state": ["Complete", "Complete", "Complete", "Complete", "Complete", "Completee", "Complete", "Complete", "Complete"]}

Is it possible to introduce some logic, so that if err: is present in the test case, that is returned by the call back module instead? All my test cases. contain err message because not all network engineers understand the default error output. This would be user experience improvement which already is available in the Python version of JSNAPy.

I believe this has been discussed in #252 and #403 so there's definitely interest in this.

Steps to reproduce

N/A

Expected results

Human friendly error output is returned.

Actual results

Value of './task-protocol-replication-state' not 'no-diff' at '.' with {"./task-protocol-replication-state": ["Complete", "Complete", "Complete", "Complete", "Complete", "Completee", "Complete", "Complete", "Complete"]}

jaakub avatar Oct 28 '22 09:10 jaakub