Skip to content

Commit 0008d1b

Browse files
martinpittrichm
authored andcommitted
fix: pmie webhook configuration for unconfigured system
If pmie never ran before, then /var/lib/pcp/config/pmie/config.default does not exist, and the `lineinfile` check mode gives `item.found == -1` instead of `0`. In that case we still want to configure the webhook. This was previously hidden as the tests run on an unclean VM (from previous tests) which caused the config file to be written. But it fails when either running linux-system-roles/metrics' tests_verify_notification.yml in isolation, or running against a container build target where services don't run.
1 parent 3ae028f commit 0008d1b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

roles/pcp/tasks/pmie.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@
5353
loop: "{{ __pcp_global_webhook_action_status.results }}"
5454
changed_when:
5555
- pcp_pmie_endpoint | length > 0
56-
- item.found | d(-1) == 0
56+
- item.found | d(-1) <= 0
5757
when:
5858
- pcp_pmie_endpoint | length > 0
59-
- item.found | d(-1) == 0
59+
- item.found | d(-1) <= 0
6060
register: __pcp_register_changed_actions_for_hosts
6161
# yamllint enable rule:line-length
6262

@@ -76,10 +76,10 @@
7676
loop: "{{ __pcp_global_webhook_endpoint_status.results }}"
7777
changed_when:
7878
- pcp_pmie_endpoint | length > 0
79-
- item.found | d(-1) == 0
79+
- item.found | d(-1) <= 0
8080
when:
8181
- pcp_pmie_endpoint | length > 0
82-
- item.found | d(-1) == 0
82+
- item.found | d(-1) <= 0
8383
register: __pcp_register_changed_actions_for_hosts
8484
# yamllint enable rule:line-length
8585

0 commit comments

Comments
 (0)