Module: check_mk
Branch: master
Commit: 42ede1aab95ae3c467e236193ef6b0abc9dc0e39
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=42ede1aab95ae3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 26 16:09:35 2014 +0100
A little more helpful information on multitar extract
---
web/htdocs/multitar.py | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/web/htdocs/multitar.py b/web/htdocs/multitar.py
index d42d143..7062420 100644
--- a/web/htdocs/multitar.py
+++ b/web/htdocs/multitar.py
@@ -262,28 +262,32 @@ def extract_domains(tar, domains):
def extract(tar, components):
for what, name, path in components:
try:
- subtarstream = tar.extractfile(name + ".tar")
- except:
- pass # may be missing, e.g. sites.tar is only present
- # if some sites have been created.
+ try:
+ subtarstream = tar.extractfile(name + ".tar")
+ except:
+ pass # may be missing, e.g. sites.tar is only present
+ # if some sites have been created.
- if what == "dir":
- target_dir = path
- else:
- target_dir = os.path.dirname(path)
-
- # Remove old stuff
- if os.path.exists(path):
if what == "dir":
- wipe_directory(path)
+ target_dir = path
else:
- os.remove(path)
- elif what == "dir":
- os.makedirs(path)
+ target_dir = os.path.dirname(path)
- # Extract without use of temporary files
- subtar = tarfile.open(fileobj = subtarstream)
- subtar.extractall(target_dir)
+ # Remove old stuff
+ if os.path.exists(path):
+ if what == "dir":
+ wipe_directory(path)
+ else:
+ os.remove(path)
+ elif what == "dir":
+ os.makedirs(path)
+
+ # Extract without use of temporary files
+ subtar = tarfile.open(fileobj = subtarstream)
+ subtar.extractall(target_dir)
+ except Exception, e:
+ import traceback
+ raise MKGeneralException('Failed to extract subtar %s: %s' % (name,
traceback.format_exc()))
# Try to cleanup everything starting from the root_path
# except the specific exclude files