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

Proposed by Barry Price
Status: Merged
Approved by: Gareth Woolridge
Approved revision: 7f3efb4be5dd2f3560837b210d850ea7e1d75004
Merged at revision: 62884614f807ca2fc1a32cfa4b02161c6d9a5ced
Proposed branch: ~barryprice/charm-canonical-livepatch/+git/canonical-livepatch-charm:lp1778447
Merge into: ~livepatch-charmers/charm-canonical-livepatch:master
Diff against target: 49 lines (+9/-6)
1 file modified
files/check_canonical-livepatch.py (+9/-6)
Reviewer Review Type Date Requested Status
Gareth Woolridge Approve
Barry Price Approve
Review via email: mp+348747@code.launchpad.net

Commit message

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

To post a comment you must log in.
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
Barry Price (barryprice) wrote :

Let's see if I can +1 my own change

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

Change cannot be self approved, setting status to needs review.

Revision history for this message
Gareth Woolridge (moon127) wrote :

LGTM

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

Change successfully merged at revision 62884614f807ca2fc1a32cfa4b02161c6d9a5ced

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/files/check_canonical-livepatch.py b/files/check_canonical-livepatch.py
2index 3a13062..4e6d54d 100755
3--- a/files/check_canonical-livepatch.py
4+++ b/files/check_canonical-livepatch.py
5@@ -3,6 +3,7 @@
6 # Copyright (C) 2016 Canonical Ltd.
7
8 import os
9+import sys
10 import nagios_plugin
11 from subprocess import check_output, call
12
13@@ -16,7 +17,8 @@ def check_package_installed():
14 try:
15 check_output(cmd, universal_newlines=True)
16 except Exception:
17- raise nagios_plugin.CriticalError("canonical-livepatch snap is not installed")
18+ print("canonical-livepatch snap is not installed")
19+ sys.exit(2)
20
21
22 ##############################################################################
23@@ -63,10 +65,12 @@ def check_status():
24
25 if err_lines:
26 err = " ".join(err_lines)
27- raise nagios_plugin.CriticalError(err)
28+ print(err)
29+ sys.exit(2)
30 elif wrn_lines:
31 wrn = " ".join(wrn_lines)
32- raise nagios_plugin.WarnError(wrn)
33+ print(wrn)
34+ sys.exit(1)
35
36
37 def lsb_release():
38@@ -104,9 +108,8 @@ def is_container():
39 def main():
40 arch = os.uname()[4]
41 if arch not in supported_archs:
42- raise nagios_plugin.CriticalError(
43- "canonical-livepatch not supported on this architecture ({}).".format(arch)
44- )
45+ print("canonical-livepatch not supported on this architecture ({}).".format(arch))
46+ sys.exit(1)
47 elif is_container():
48 print("canonical-livepatch not needed in OS containers.")
49 else:

Subscribers

People subscribed via source and target branches