Merge ~vultaire/charm-hw-health:remove-check-ilorest.py into charm-hw-health:master

Proposed by Paul Goins
Status: Merged
Approved by: Xav Paice
Approved revision: f7d0294e5eaf22def59dd997959ef4ce87b7f22e
Merged at revision: 27fac689cbfacc017432d71acb66fee5f5f2211e
Proposed branch: ~vultaire/charm-hw-health:remove-check-ilorest.py
Merge into: charm-hw-health:master
Diff against target: 77 lines (+0/-71)
1 file modified
dev/null (+0/-71)
Reviewer Review Type Date Requested Status
Xav Paice (community) Approve
Drew Freiberger (community) Approve
Review via email: mp+389199@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Goins (vultaire) wrote :

This tool actually uses src/files/common/check_hw_health_cron_output.py instead, but when the change to the common file was made, the tool's own version of the script was never removed.

Revision history for this message
Drew Freiberger (afreiberger) wrote :

+1, AptVendorTool class defaults to check_hw_health_cron_output.py and ILOrest does not override this.

review: Approve
Revision history for this message
Xav Paice (xavpaice) wrote :

Agreed, lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/files/ilorest/check_ilorest.py b/src/files/ilorest/check_ilorest.py
2deleted file mode 100755
3index 4d42309..0000000
4--- a/src/files/ilorest/check_ilorest.py
5+++ /dev/null
6@@ -1,71 +0,0 @@
7-#!/usr/bin/env python3
8-# ------------------------------------------------
9-# This file is juju managed
10-# ------------------------------------------------
11-
12-# Copyright (C) 2008, 2009, 2012 James Troup <james.troup@canonical.com>
13-# Copyright (C) 2009 LaMont Jones <lamont.jones@canonical.com>
14-
15-###############################################################################
16-
17-from optparse import OptionParser
18-
19-from nagios_plugin3 import check_file_freshness, try_check, WarnError, CriticalError
20-
21-
22-###############################################################################
23-
24-
25-def check_and_open(filename, time_limit):
26- check_file_freshness(filename, time_limit)
27- return open(filename)
28-
29-
30-###############################################################################
31-
32-
33-def check_file_contents(input_filename, time_limit):
34- input_file = check_and_open(input_filename, time_limit)
35- for line in input_file.readlines():
36- line = line.rstrip()
37- if not line:
38- continue
39- if line.startswith("WARN"):
40- raise WarnError(line)
41- elif line.startswith("OK"):
42- print(line)
43- else:
44- raise CriticalError(line)
45-
46-
47-###############################################################################
48-
49-
50-def main():
51- parser = OptionParser()
52- parser.add_option(
53- "--time",
54- dest="time_limit",
55- help="freshness time limit [default=%default]",
56- metavar="SECONDS",
57- default=1200,
58- type=int,
59- )
60- parser.add_option(
61- "-f",
62- "--filename",
63- dest="input_file",
64- help=("file containing the output of cron_ilorest.py [default=%default]"),
65- metavar="FILE",
66- default="/var/lib/nagios/ilorest.out",
67- type=str,
68- )
69-
70- (opts, args) = parser.parse_args()
71-
72- try_check(check_file_contents, opts.input_file, opts.time_limit)
73- print("All OK")
74-
75-
76-if __name__ == "__main__":
77- main()

Subscribers

People subscribed via source and target branches

to all changes: