Module: check_mk
Branch: master
Commit: 13e4887a2d4a1408418c9a705820107ccdbd66a5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=13e4887a2d4a14…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Feb 26 18:10:14 2014 +0100
werk 559: fixed bug exception when uploading snapshots
---
ChangeLog | 2 +-
web/htdocs/multitar.py | 3 ++-
web/htdocs/wato.py | 8 ++++++--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f12811b..64d651f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -202,7 +202,7 @@
* 0665 Added mail notificaton method to custom user notification dialog...
* 0123 New time range filter for Downtimes and Comments...
* 0683 New column painter for the last time a service was OK...
- * 0561 quicksearch: now able to search for multiple patterns...
+ * 0561 quicksearch: now able to search with multiple filters...
* 0302 FIX: Fixed highlight of choosen elements in foldertee/views snapin in
Chrome/IE
* 0239 FIX: Fixed incorrect html formatting when displaying host or service
comments...
* 0307 FIX: Increased performance of multisite GUI with a large userbase...
diff --git a/web/htdocs/multitar.py b/web/htdocs/multitar.py
index aafe2ef..0c785f1 100644
--- a/web/htdocs/multitar.py
+++ b/web/htdocs/multitar.py
@@ -88,6 +88,7 @@ def list_tar_content(the_tarfile):
files = {}
try:
if type(the_tarfile) != str:
+ the_tarfile.seek(0)
tar = tarfile.open("r", fileobj = the_tarfile)
else:
tar = tarfile.open(the_tarfile, "r")
@@ -98,10 +99,10 @@ def list_tar_content(the_tarfile):
def get_file_content(the_tarfile, filename):
if type(the_tarfile) != str:
+ the_tarfile.seek(0)
tar = tarfile.open("r", fileobj = the_tarfile)
else:
tar = tarfile.open(the_tarfile, "r")
- tar = tarfile.open(the_tarfile, "r")
return tar.extractfile(filename).read()
def extract_domains(tar, domains):
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 20eb882..372ef61 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -5941,7 +5941,10 @@ def get_snapshot_status(snapshot):
else: # new snapshots
for entry in ["comment", "created_by",
"type"]:
if entry in status["files"]:
- status[entry] = multitar.get_file_content(snapshot_dir + name,
entry)
+ if file_stream:
+ status[entry] = multitar.get_file_content(file_stream, entry)
+ else:
+ status[entry] = multitar.get_file_content(snapshot_dir + name,
entry)
else:
raise MKGeneralException(_("Invalid snapshot (missing file:
%s)") % entry)
@@ -5986,7 +5989,8 @@ def get_snapshot_status(snapshot):
status["broken"] = True
pass
except Exception, e:
- status["broken_text"] = e.message
+ import traceback
+ status["broken_text"] = traceback.format_exc()
status["broken"] = True
pass
return status