Merge lp:~mthaddon/charms/precise/nrpe-external-master/nagios-plugin-fix into lp:charms/nrpe-external-master

Proposed by Tom Haddon
Status: Merged
Merged at revision: 23
Proposed branch: lp:~mthaddon/charms/precise/nrpe-external-master/nagios-plugin-fix
Merge into: lp:charms/nrpe-external-master
Diff against target: 44 lines (+11/-6)
2 files modified
files/nagios_plugin.py (+2/-4)
hooks/install (+9/-2)
To merge this branch: bzr merge lp:~mthaddon/charms/precise/nrpe-external-master/nagios-plugin-fix
Reviewer Review Type Date Requested Status
Matthew Wedgwood (community) Approve
Review via email: mp+159665@code.launchpad.net

Description of the change

Fix line breaks in nagios_plugin.py

To post a comment you must log in.
Revision history for this message
Matthew Wedgwood (mew) wrote :

This is Matthew and I approve this merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'files/nagios_plugin.py'
2--- files/nagios_plugin.py 2012-10-02 19:33:44 +0000
3+++ files/nagios_plugin.py 2013-04-18 15:47:28 +0000
4@@ -67,12 +67,10 @@
5 mtime = os.stat(filename)[stat.ST_MTIME]
6 last_modified = time.time() - mtime
7 if last_modified > newer_than:
8- raise CriticalError("%s: was last modified on %s and is too old (> %s
9-seconds)."
10+ raise CriticalError("%s: was last modified on %s and is too old (> %s seconds)."
11 % (filename, time.ctime(mtime), newer_than))
12 if last_modified < 0:
13- raise CriticalError("%s: was last modified on %s which is in the
14-future."
15+ raise CriticalError("%s: was last modified on %s which is in the future."
16 % (filename, time.ctime(mtime)))
17
18 ################################################################################
19
20=== modified file 'hooks/install'
21--- hooks/install 2012-11-26 04:29:01 +0000
22+++ hooks/install 2013-04-18 15:47:28 +0000
23@@ -8,12 +8,19 @@
24 while true; do
25 lsof /var/lib/dpkg/lock > /dev/null 2>&1 || APT_LOCKED=0
26 if [[ $APT_LOCKED -eq 0 ]]; then
27+ RET=0
28+ # It's possible that if multiple subordinate charms attempt to install
29+ # a package at exactly the same time neither will see the dpkg lock but
30+ # then when attempting to actually install they'll conflict. If so, just
31+ # ignore and try again in another minute, by which time hopefully it
32+ # will have finished.
33 apt-get install -q -y nagios-nrpe-server \
34 nagios-plugins-basic \
35 nagios-plugins-standard \
36 rsync \
37- python-cheetah
38- break
39+ python-cheetah || RET=$? && [[ $RET -ne 100 ]] \
40+ && [[ $RET -ne 0 ]] && exit $RET
41+ [[ $RET -eq 100 ]] || break
42 fi
43 if [[ $COUNTER -gt 5 ]]; then
44 echo "Failed to obtain apt lock"

Subscribers

People subscribed via source and target branches

to all changes: