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

Proposed by Barry Price
Status: Merged
Merged at revision: c523178f3ef316762529ce17c882ae555cad48f2
Proposed branch: ~barryprice/charm-canonical-livepatch/+git/canonical-livepatch-charm:master
Merge into: ~livepatch-charmers/charm-canonical-livepatch:master
Diff against target: 60 lines (+10/-8)
2 files modified
files/check_canonical-livepatch.py (+2/-2)
reactive/canonical_livepatch.py (+8/-6)
Reviewer Review Type Date Requested Status
Livepatch charm developers Pending
Review via email: mp+314314@code.launchpad.net
To post a comment you must log in.

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 3953661..27c9f69 100644
3--- a/files/check_canonical-livepatch.py
4+++ b/files/check_canonical-livepatch.py
5@@ -4,7 +4,7 @@
6
7 import os
8 import nagios_plugin
9-from subprocess import check_call, check_output
10+from subprocess import check_output
11
12
13 ################################################################################
14@@ -12,7 +12,7 @@ from subprocess import check_call, check_output
15 def check_package_installed():
16 cmd = ['snap', 'list', 'canonical-livepatch']
17 try:
18- res = check_output(cmd, universal_newlines=True)
19+ check_output(cmd, universal_newlines=True)
20 except:
21 raise nagios_plugin.CriticalError("canonical-livepatch snap is not installed")
22
23diff --git a/reactive/canonical_livepatch.py b/reactive/canonical_livepatch.py
24index ce47d43..102df07 100644
25--- a/reactive/canonical_livepatch.py
26+++ b/reactive/canonical_livepatch.py
27@@ -149,14 +149,14 @@ def update_key():
28 cmd = ['/snap/bin/canonical-livepatch', 'disable']
29 hookenv.log('Disabling canonical-livepatch ahead of key change to work around LP#1628823')
30 try:
31- __ = check_output(cmd, universal_newlines=True)
32+ check_output(cmd, universal_newlines=True)
33 except CalledProcessError as e:
34 hookenv.log('Unable to deactivate: {}'.format(str(e)))
35
36 cmd = ['/snap/bin/canonical-livepatch', 'enable', '{}'.format(livepatch_key.strip())]
37 hookenv.log('Activating canonical-livepatch with your key')
38 try:
39- __ = check_output(cmd, universal_newlines=True)
40+ check_output(cmd, universal_newlines=True)
41 except CalledProcessError as e:
42 hookenv.log('Unable to activate: {}'.format(str(e)))
43 hookenv.status_set('blocked', 'Activation failed')
44@@ -212,10 +212,12 @@ def init_nagios_checks(nagios):
45 'files/check_canonical-livepatch.py',
46 '/usr/lib/nagios/plugins/check_canonical-livepatch.py',
47 )
48- file_to_units(
49- 'files/canonical-livepatch-status.txt',
50- '/var/lib/nagios/canonical-livepatch-status.txt',
51- )
52+ # don't overwrite an existing status file
53+ if not path.exists('/var/lib/nagios/canonical-livepatch-status.txt'):
54+ file_to_units(
55+ 'files/canonical-livepatch-status.txt',
56+ '/var/lib/nagios/canonical-livepatch-status.txt',
57+ )
58
59 # use the interface to create the check
60 nagios.add_check(["/usr/lib/nagios/plugins/check_canonical-livepatch.py", ],

Subscribers

People subscribed via source and target branches