summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2013-10-13 14:36:06 +0100
committerLars Wirzenius <liw@liw.fi>2013-10-13 14:36:06 +0100
commit8ed777e3abaa62b129b678a02d4c8d82ae2f4c5b (patch)
treef27bb941bbdefe806b493379f1563f3e6595a4de
parentb9f89930a95bff65d66ed18981042fdc8f41ecc4 (diff)
downloadobnam-8ed777e3abaa62b129b678a02d4c8d82ae2f4c5b.tar.gz
Handle no-backup-yet correctly for Nagios
Patch by Lars Kruse.
-rw-r--r--NEWS4
-rw-r--r--obnamlib/plugins/show_plugin.py6
2 files changed, 9 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 1c67fe15..83b1dd45 100644
--- a/NEWS
+++ b/NEWS
@@ -56,6 +56,10 @@ Bug fixes:
sufficiently new versions of Paramiko (1.7.7.1 in Debian wheezy is
OK). Reported by Lars Kruse.
+* The nagios plugin for Obnam now correctly handles the case
+ where a backup repository for a client exists, but does not have
+ a backup yet. Patch by Lars Kruse.
+
Version 1.5, released 2013-08-08
--------------------------------
diff --git a/obnamlib/plugins/show_plugin.py b/obnamlib/plugins/show_plugin.py
index 1b94ffc5..93aec835 100644
--- a/obnamlib/plugins/show_plugin.py
+++ b/obnamlib/plugins/show_plugin.py
@@ -117,7 +117,11 @@ class ShowPlugin(obnamlib.ObnamPlugin):
self.repo.fs.close()
now = self.app.time()
- if (now - most_recent > critical_age):
+ if most_recent is None:
+ # the repository is empty / the client does not exist
+ self.app.output.write('CRITICAL: no backup found.\n')
+ sys.exit(2)
+ elif (now - most_recent > critical_age):
self.app.output.write(
'CRITICAL: backup is old. last backup was %s.\n' %
(self.format_time(most_recent)))