Skip to content

Commit cf6761d

Browse files
authored
[test_snmp_traps] Add debug after a failure (#210)
Use rescue to provide additional information when the test fails
1 parent 3b7306d commit cf6761d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

roles/test_snmp_traps/tasks/main.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,18 @@
6969
- name: "RHELOSP-144481 Check for snmpTraps logs"
7070
ansible.builtin.shell:
7171
cmd: |
72-
oc logs -l "app=default-snmp-webhook" | grep "Sending SNMP trap"
72+
oc logs -l "app=default-snmp-webhook" | grep "Sending SNMP trap"
7373
register: cmd_output
7474
changed_when: false
7575
failed_when: "cmd_output.stdout_lines | length == 0"
7676

77+
rescue:
78+
- name: "Get the snmp traps logs"
79+
ansible.builtin.shell:
80+
cmd: |
81+
oc logs -l "app=default-snmp-webhook"
82+
changed_when: false
83+
7784
always:
7885
- name: "Delete the PrometheusRule"
7986
ansible.builtin.command:

0 commit comments

Comments
 (0)