Merge lp:~hloeung/ubuntu-repository-cache/nagios-checks-only-when-nrpe-related into lp:ubuntu-repository-cache

Proposed by Haw Loeung
Status: Merged
Approved by: Haw Loeung
Approved revision: 283
Merged at revision: 283
Proposed branch: lp:~hloeung/ubuntu-repository-cache/nagios-checks-only-when-nrpe-related
Merge into: lp:ubuntu-repository-cache
Diff against target: 44 lines (+10/-1)
1 file modified
reactive/ubuntu-repository-cache.py (+10/-1)
To merge this branch: bzr merge lp:~hloeung/ubuntu-repository-cache/nagios-checks-only-when-nrpe-related
Reviewer Review Type Date Requested Status
Paul Collins lgtm Approve
Canonical IS Reviewers Pending
Canonical IS Reviewers Pending
Review via email: mp+389056@code.launchpad.net

This proposal supersedes a proposal from 2020-08-11.

Commit message

Only ship out the nagios checks when nrpe related

By default, checks are configured and updated even if nrpe relation isn't available (or service related to nrpe). This fixes that and also adds extra logging as to when function to update checks and restart/reload nrpe fires.

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote : Posted in a previous version of this proposal

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote : Posted in a previous version of this proposal

Unable to determine commit message from repository - please click "Set commit message" and enter the commit message manually.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Paul Collins (pjdc) :
review: Approve (lgtm)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 283

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'reactive/ubuntu-repository-cache.py'
2--- reactive/ubuntu-repository-cache.py 2020-08-11 03:22:00 +0000
3+++ reactive/ubuntu-repository-cache.py 2020-08-11 05:05:41 +0000
4@@ -37,13 +37,13 @@
5
6 LOG('Config changed for %s' % SERVICE)
7 reactive.clear_flag('ubuntu-repository-cache.configured')
8+ reactive.clear_flag('nagios-nrpe.configured')
9
10
11 @reactive.when('ubuntu-repository-cache.installed')
12 @reactive.when_not('ubuntu-repository-cache.configured')
13 def configure_services():
14 service.render_configs()
15- service.update_checks()
16
17 # We should always do this anyway, but currently,
18 # due to LP#1626318, following a reboot, the ephemeral
19@@ -62,6 +62,7 @@
20
21 LOG('Upgrading %s' % SERVICE)
22 reactive.clear_flag('ubuntu-repository-cache.configured')
23+ reactive.clear_flag('nagios-nrpe.configured')
24
25
26 @reactive.hook('start')
27@@ -173,9 +174,17 @@
28 @reactive.hook('nrpe-external-master-relation-changed')
29 @reactive.hook('local-monitors-relation-changed')
30 def update_checks():
31+ reactive.clear_flag('nagios-nrpe.configured')
32+
33+
34+@reactive.when('ubuntu-repository-cache.configured')
35+@reactive.when('nrpe-external-master.available')
36+@reactive.when_not('nagios-nrpe.configured')
37+def configure_nagios():
38 '''Update Nagios checks for all services'''
39
40 service.update_checks()
41+ reactive.set_flag('nagios-nrpe.configured')
42
43
44 @reactive.hook('leader-elected')

Subscribers

People subscribed via source and target branches