← 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.

Commit message:
Properly trap/detect unsupported installs

Requested reviews:
  Livepatch charm developers (livepatch-charmers)

For more details, see:
https://code.launchpad.net/~barryprice/canonical-livepatch-charm/+git/canonical-livepatch-charm/+merge/348326
-- 
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/Makefile b/Makefile
index 630e665..3b5e144 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,7 @@ clean:
 
 .PHONY: testdeps
 testdeps:
+	@export DEBIAN_FRONTEND=noninteractive
 	@sudo apt-get update
 	@sudo apt-get install -y make flake8 python3-flake8 python3-pip python-pip snapd
 	@which juju >/dev/null || (sudo snap install juju --classic)
diff --git a/reactive/canonical_livepatch.py b/reactive/canonical_livepatch.py
index 7c0b559..0a0d154 100644
--- a/reactive/canonical_livepatch.py
+++ b/reactive/canonical_livepatch.py
@@ -183,7 +183,7 @@ def activate_livepatch():
 register_trigger(when='config.changed.livepatch_proxy', clear_flag='livepatch-proxy.configured')
 
 
-@when_not('snap.installed.canonical-livepatch')
+@when('snap.installed.canonical-livepatch')
 def livepatch_supported():
     arch = uname()[4]
     opts = layer.options('snap')
@@ -191,11 +191,13 @@ def livepatch_supported():
     if supported_archs and arch not in supported_archs:
         hookenv.log('Livepatch does not currently support {} architecture'.format(arch))
         unit_update('blocked', 'Architecture {} is not supported by livepatch'.format(arch))
-    if is_container():
+    elif is_container():
         hookenv.log('OS container detected, livepatch is not needed')
         unit_update('blocked', 'Livepatch is not needed in OS containers')
+    else:
+        set_flag('canonical-livepatch.supported')
 
-
+@when('canonical-livepatch.supported')
 @when_not('livepatch-proxy.configured')
 def proxy_configure():
     # Configure proxies early, if required - LP#1761661
@@ -208,7 +210,7 @@ def proxy_configure():
 
 
 @when('snap.installed.canonical-livepatch')
-@when('livepatch-proxy.configured')
+@when('livepatch.proxy.configured')
 @when_not('canonical-livepatch.connected')
 def canonical_livepatch_connect():
     # So if we've just installed snapd on a trusty system, we will not be on

References