Skip to content

Commit

Permalink
[test_snmp_traps] Remove grep and update failed_when
Browse files Browse the repository at this point in the history
  • Loading branch information
elfiesmelfie committed Nov 22, 2024
1 parent 5c16bea commit 562dcb9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions roles/test_snmp_traps/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,15 @@
- name: "RHELOSP-144481 Check for snmpTraps logs"
ansible.builtin.shell:
cmd: |
oc logs -l "app=default-snmp-webhook" | grep "Sending SNMP trap"
oc logs -l "app=default-snmp-webhook"
register: cmd_output
changed_when: false
failed_when: "cmd_output.stdout_lines | length == 0"
failed_when: "'Sending SNMP trap' not in cmd_output.stdout"

rescue:
- name: "Get the snmp traps logs"
ansible.builtin.shell:
cmd: |
oc logs -l "app=default-snmp-webhook"
ansible.builtin.debug:
var: cmd_output.stdout

always:
- name: "Delete the alert"
Expand Down

0 comments on commit 562dcb9

Please sign in to comment.