Module: check_mk
Branch: master
Commit: bf2becb5c92e698ab8140d5e59396360bc5bf923
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bf2becb5c92e69…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Oct 12 10:54:55 2017 +0200
5235 FIX Distributed monitoring: Fixed race condition when unpacking snapshots
Fix exception during snapshot extraction when a file planned for removal was deleted by
another process.
Change-Id: I8d3f8f18b01db3bef114a66d45523b198b094ab2
---
.werks/5235 | 11 +++++++++++
web/htdocs/multitar.py | 6 +++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/.werks/5235 b/.werks/5235
new file mode 100644
index 0000000..9102468
--- /dev/null
+++ b/.werks/5235
@@ -0,0 +1,11 @@
+Title: Distributed monitoring: Fixed race condition when unpacking snapshots
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1507797868
+
+Fix exception during snapshot extraction when a file planned for removal was deleted by
another process.
diff --git a/web/htdocs/multitar.py b/web/htdocs/multitar.py
index 7bc7631..23b6fa5 100644
--- a/web/htdocs/multitar.py
+++ b/web/htdocs/multitar.py
@@ -614,7 +614,7 @@ def cleanup_dir(root_path, exclude_files=None):
for path in paths_to_remove:
if os.path.exists(path) and os.path.isdir(path):
- shutil.rmtree(path)
+ shutil.rmtree(path, ignore_errors=True)
for filename in files_to_remove:
if os.path.dirname(filename) not in paths_to_remove:
@@ -625,9 +625,9 @@ def wipe_directory(path):
if entry not in [ '.', '..' ]:
p = path + "/" + entry
if os.path.isdir(p):
- shutil.rmtree(p)
+ shutil.rmtree(p, ignore_errors=True)
else:
- try:
+ try:
os.remove(p)
except OSError as e:
if e.errno == 2: # no such file or directory