← Back to team overview

livepatch-charmers team mailing list archive

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

 

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

Commit message:
Reverse fix for LP#1778447 as it seems to do the opposite

Requested reviews:
  Livepatch charm developers (livepatch-charmers)

For more details, see:
https://code.launchpad.net/~barryprice/canonical-livepatch-charm/+git/canonical-livepatch-charm/+merge/348747
-- 
Your team Livepatch charm developers is requested to review the proposed merge of ~barryprice/canonical-livepatch-charm/+git/canonical-livepatch-charm:lp1778447 into canonical-livepatch-charm:master.
diff --git a/files/check_canonical-livepatch.py b/files/check_canonical-livepatch.py
index 3a13062..4e6d54d 100755
--- a/files/check_canonical-livepatch.py
+++ b/files/check_canonical-livepatch.py
@@ -3,6 +3,7 @@
 # Copyright (C) 2016 Canonical Ltd.
 
 import os
+import sys
 import nagios_plugin
 from subprocess import check_output, call
 
@@ -16,7 +17,8 @@ def check_package_installed():
     try:
         check_output(cmd, universal_newlines=True)
     except Exception:
-        raise nagios_plugin.CriticalError("canonical-livepatch snap is not installed")
+        print("canonical-livepatch snap is not installed")
+        sys.exit(2)
 
 
 ##############################################################################
@@ -63,10 +65,12 @@ def check_status():
 
     if err_lines:
         err = " ".join(err_lines)
-        raise nagios_plugin.CriticalError(err)
+        print(err)
+        sys.exit(2)
     elif wrn_lines:
         wrn = " ".join(wrn_lines)
-        raise nagios_plugin.WarnError(wrn)
+        print(wrn)
+        sys.exit(1)
 
 
 def lsb_release():
@@ -104,9 +108,8 @@ def is_container():
 def main():
     arch = os.uname()[4]
     if arch not in supported_archs:
-        raise nagios_plugin.CriticalError(
-            "canonical-livepatch not supported on this architecture ({}).".format(arch)
-        )
+        print("canonical-livepatch not supported on this architecture ({}).".format(arch))
+        sys.exit(1)
     elif is_container():
         print("canonical-livepatch not needed in OS containers.")
     else:

References