Module: check_mk
Branch: master
Commit: d86195274f695575121ce71f9461f4d2d1f787b6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d86195274f6955…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 4 10:12:27 2013 +0100
FIX: Added error handling when trying to --restore with a non existant file
---
.bugs/807 | 7 +++++--
ChangeLog | 1 +
modules/check_mk.py | 3 +++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/.bugs/807 b/.bugs/807
index 75ab120..f5a42e8 100644
--- a/.bugs/807
+++ b/.bugs/807
@@ -1,9 +1,12 @@
Title: cmk --restore does report errors
Component: core
-State: open
+Class: cleanup
+State: done
Date: 2012-10-10 12:58:08
Targetversion: 1.2.0
-Class: cleanup
cmk --restore does not set an returncode != 1 or print errors if the restore
failed if the input file was unreadable or missing or somehow else troubled.
+
+2013-01-04 10:11:48: changed state open -> done
+Added error message when the file given to restore does not exist
diff --git a/ChangeLog b/ChangeLog
index 6ae1cc0..9230d87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
* Do object cache precompile for monitoring core on cmk -R/-O
* Avoid duplicate verification of monitoring config on cmk -R/-O
* FIX: Parameter --cleanup-autochecks (long for -u) works now like suggested in help
+ * FIX: Added error handling when trying to --restore with a non existant file
Notifications:
* Fix flexible notifications on non-OMD systems
diff --git a/modules/check_mk.py b/modules/check_mk.py
index a35e1cb..ad39048 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -3278,6 +3278,9 @@ def do_restore(tarname):
if opt_verbose:
sys.stderr.write("Restoring from '%s'...\n" % tarname)
+ if not os.path.exists(tarname):
+ raise MKGeneralException("Unable to restore: File does not exist")
+
for name, path, canonical_name, descr, is_dir, owned_by_nagios, group_www in
backup_paths:
absdir = os.path.abspath(path)
if is_dir: