-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logging does not work when running jsnapy with ansible #393
Comments
issue is reproducible with the following information
Thanks |
Merged
chidanandpujar
added a commit
to chidanandpujar/jsnapy
that referenced
this issue
Jun 12, 2024
chidanandpujar
added a commit
to chidanandpujar/jsnapy
that referenced
this issue
Jun 12, 2024
Fixed Juniper#327 Fixed Juniper#330 commented out deletion test results
chidanandpujar
added a commit
to chidanandpujar/jsnapy
that referenced
this issue
Jun 12, 2024
Fixed Juniper#327 Fixed Juniper#330 commented out deletion test results
chidanandpujar
added a commit
to chidanandpujar/jsnapy
that referenced
this issue
Jul 17, 2024
Fixed Juniper#327 Fixed Juniper#330 commented out deletion test results
Pass logs:
Thanks |
operator exists now reports info/err messages as part of fix #415 and also failed tests can be copied to dest_dir and it is supported via Juniper/ansible-junos-stdlib#678 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of Issue/Question
Hi,
I have integrated jsnapy with ansible so that I can use ansible playbook to run jsnapy.
However the info and err from my jsnapy tests are not outputing when I run the ansible playbook.
As the documentation suggests, I have tried both of the configs below on ansible.cfg but still no output
callback_enabled = juniper.device.jsnapy
callback_whitelist = juniper.device.jsnapy
Setup
The following files are created
I am adding the files below
`
snapcheck_playbook.yml
name: "Ansible Jsnapy Snapcheck"
hosts: all
strategy: free
connection: local
gather_facts: false
tasks:
name: Run Jsnapy check
juniper.device.jsnapy:
action: snapcheck
config_file: jsnapy_tests.yml
logfile: jsnapy_ansible.log
register: result
name: Run Jsnapy check
assert:
that:
jsnapy_tests.yml
tests:
test_snmp.yml
Test SNMP config:
xpath: /configuration/snmp
tests:
- exists: community[name='mycommunity']
info: SNMP community ''mycommunity' is configured.
err: SNMP community ''mycommunity' is not configured!
`
Steps to Reproduce Issue
(Include debug logs if possible and relevant. Error trace would be helpful too)
To run the playbook:
$ ansible-playbook snapcheck_playbook.yml -l mydevice
PLAY [Ansible Jsnapy Snapcheck] *******************************************************************************************************
TASK [Run Jsnapy check] ***************************************************************************************************************
ok: [mydevice]
TASK [Run Jsnapy check] ***************************************************************************************************************
fatal: [mydevice]: FAILED! => {
"assertion": "result.passPercentage == 100",
"changed": false,
"evaluated_to": false,
"msg": "Assertion failed"
}
PLAY RECAP ****************************************************************************************************************************
mydevice : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
As you can see from the above, the tests failed as expected (because the snmp community is not set at my router yet. However the err message is not displayed on the output.
I can see the errors on the jsnapy.log but not on the output from the command
Versions Report
(Provided by running
jsnapy --version
. Please also mention python version.)$ jsnapy --version
JSNAPy version: 1.3.6
$ ansible --version
ansible [core 2.11.1]
$ python --version
Python 3.9.5
The text was updated successfully, but these errors were encountered: