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
diff --git a/files/check_canonical-livepatch.py b/files/check_canonical-livepatch.py
index 4e6d54d..3a13062 100755
--- a/files/check_canonical-livepatch.py
+++ b/files/check_canonical-livepatch.py
@@ -3,7 +3,6 @@
3# Copyright (C) 2016 Canonical Ltd.3# Copyright (C) 2016 Canonical Ltd.
44
5import os5import os
6import sys
7import nagios_plugin6import nagios_plugin
8from subprocess import check_output, call7from subprocess import check_output, call
98
@@ -17,8 +16,7 @@ def check_package_installed():
17 try:16 try:
18 check_output(cmd, universal_newlines=True)17 check_output(cmd, universal_newlines=True)
19 except Exception:18 except Exception:
20 print("canonical-livepatch snap is not installed")19 raise nagios_plugin.CriticalError("canonical-livepatch snap is not installed")
21 sys.exit(2)
2220
2321
24##############################################################################22##############################################################################
@@ -65,12 +63,10 @@ def check_status():
6563
66 if err_lines:64 if err_lines:
67 err = " ".join(err_lines)65 err = " ".join(err_lines)
68 print(err)66 raise nagios_plugin.CriticalError(err)
69 sys.exit(2)
70 elif wrn_lines:67 elif wrn_lines:
71 wrn = " ".join(wrn_lines)68 wrn = " ".join(wrn_lines)
72 print(wrn)69 raise nagios_plugin.WarnError(wrn)
73 sys.exit(1)
7470
7571
76def lsb_release():72def lsb_release():
@@ -108,8 +104,9 @@ def is_container():
108def main():104def main():
109 arch = os.uname()[4]105 arch = os.uname()[4]
110 if arch not in supported_archs:106 if arch not in supported_archs:
111 print("canonical-livepatch not supported on this architecture ({}).".format(arch))107 raise nagios_plugin.CriticalError(
112 sys.exit(1)108 "canonical-livepatch not supported on this architecture ({}).".format(arch)
109 )
113 elif is_container():110 elif is_container():
114 print("canonical-livepatch not needed in OS containers.")111 print("canonical-livepatch not needed in OS containers.")
115 else:112 else:

Subscribers

People subscribed via source and target branches