← Back to team overview

livepatch-charmers team mailing list archive

[Merge] ~barryprice/canonical-livepatch-charm/+git/canonical-livepatch-charm:master into canonical-livepatch-charm:master

 

Barry Price has proposed merging ~barryprice/canonical-livepatch-charm/+git/canonical-livepatch-charm:master into canonical-livepatch-charm:master.

Requested reviews:
  Livepatch charm developers (livepatch-charmers)

For more details, see:
https://code.launchpad.net/~barryprice/canonical-livepatch-charm/+git/canonical-livepatch-charm/+merge/323321

Currently testing.

This should fix LP#1681036
-- 
Your team Livepatch charm developers is requested to review the proposed merge of ~barryprice/canonical-livepatch-charm/+git/canonical-livepatch-charm:master into canonical-livepatch-charm:master.
diff --git a/reactive/canonical_livepatch.py b/reactive/canonical_livepatch.py
index c467bec..9aa91a4 100644
--- a/reactive/canonical_livepatch.py
+++ b/reactive/canonical_livepatch.py
@@ -238,9 +238,20 @@ def update_livepatch_proxy():
     update_key()
 
 
+@when('config.changed.nagios_context')
+def update_nagios_context():
+    remove_state('canonical-livepatch.nagios-configured')
+
+
+@when('config.changed.nagios_servicegroups')
+def update_nagios_servicegroups():
+    remove_state('canonical-livepatch.nagios-configured')
+
+
 @when('snap.installed.canonical-livepatch')
 @when('nrpe-external-master.available')
-def init_nagios_checks(nagios):
+@when_not('canonical-livepatch.nagios-configured')
+def configure_nagios(nagios):
 
     # Ask charmhelpers.contrib.charmsupport's nrpe to work out our hostname
     hostname = nrpe.get_nagios_hostname()
@@ -264,7 +275,7 @@ def init_nagios_checks(nagios):
 
     # remove check from previous release with poorly formed name
     nrpe_setup.remove_check(
-       shortname = 'check_canonical-livepatch'
+       shortname='check_canonical-livepatch'
     )
 
     # use charmhelpers to create the check
@@ -275,6 +286,7 @@ def init_nagios_checks(nagios):
     )
 
     nrpe_setup.write()
+    set_state('canonical-livepatch.nagios-configured')
 
 
 @when('snap.installed.canonical-livepatch')

Follow ups