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: Paul Gear
Approved revision: 5e56c1fe236f15f939be59924799694e2798155b
Merged at revision: 5a22e593df257a2302a1dd7395675e35f0fcb7dc
Proposed branch: ~barryprice/charm-canonical-livepatch/+git/canonical-livepatch-charm:lp1778447
Merge into: ~livepatch-charmers/charm-canonical-livepatch:master
Diff against target: 49 lines (+6/-9)
1 file modified
files/check_canonical-livepatch.py (+6/-9)
Reviewer Review Type Date Requested Status
Paul Gear (community) Approve
Review via email: mp+348713@code.launchpad.net

Commit message

Address LP#1778447

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
Paul Gear (paulgear) wrote :

LGTM

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

Change successfully merged at revision 5a22e593df257a2302a1dd7395675e35f0fcb7dc

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 4e6d54d..3a13062 100755
3--- a/files/check_canonical-livepatch.py
4+++ b/files/check_canonical-livepatch.py
5@@ -3,7 +3,6 @@
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@@ -17,8 +16,7 @@ def check_package_installed():
14 try:
15 check_output(cmd, universal_newlines=True)
16 except Exception:
17- print("canonical-livepatch snap is not installed")
18- sys.exit(2)
19+ raise nagios_plugin.CriticalError("canonical-livepatch snap is not installed")
20
21
22 ##############################################################################
23@@ -65,12 +63,10 @@ def check_status():
24
25 if err_lines:
26 err = " ".join(err_lines)
27- print(err)
28- sys.exit(2)
29+ raise nagios_plugin.CriticalError(err)
30 elif wrn_lines:
31 wrn = " ".join(wrn_lines)
32- print(wrn)
33- sys.exit(1)
34+ raise nagios_plugin.WarnError(wrn)
35
36
37 def lsb_release():
38@@ -108,8 +104,9 @@ def is_container():
39 def main():
40 arch = os.uname()[4]
41 if arch not in supported_archs:
42- print("canonical-livepatch not supported on this architecture ({}).".format(arch))
43- sys.exit(1)
44+ raise nagios_plugin.CriticalError(
45+ "canonical-livepatch not supported on this architecture ({}).".format(arch)
46+ )
47 elif is_container():
48 print("canonical-livepatch not needed in OS containers.")
49 else:

Subscribers

People subscribed via source and target branches