Module: check_mk
Branch: master
Commit: 3f372485dd02200d9423596562f5c01772635ffe
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3f372485dd0220…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Mar 9 14:57:54 2016 +0100
3281 FIX Fixed network scan overwriting folder modifications made during the scan
---
.werks/3281 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 12 ++++++++++--
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/.werks/3281 b/.werks/3281
new file mode 100644
index 0000000..70ff88b
--- /dev/null
+++ b/.werks/3281
@@ -0,0 +1,10 @@
+Title: Fixed network scan overwriting folder modifications made during the scan
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1457531844
+
+
diff --git a/ChangeLog b/ChangeLog
index 6d5bf27..283d591 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -113,6 +113,7 @@
* 3086 FIX: fixed incorrect host list when one wato folder was a substring of
another...
* 3091 FIX: fixed failure to rename hosts in raw edition...
* 3280 FIX: Fixed too often executed network scans...
+ * 3281 FIX: Fixed network scan overwriting folder modifications made during the scan
Notifications:
* 3263 Notifications: allow users to restrict by their contact groups...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index e8bd23a..84c2e65 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15055,8 +15055,16 @@ def add_scanned_hosts_to_folder(folder, found):
def save_network_scan_result(folder, result):
- folder.set_attribute("network_scan_result", result)
- folder.save()
+ # Reload the folder, lock WATO before to protect against concurrency problems.
+ lock_exclusive()
+
+ # A user might have changed the folder somehow since starting the scan. Load the
+ # folder again to get the current state.
+ write_folder = Folder.folder(folder.path())
+ write_folder.set_attribute("network_scan_result", result)
+ write_folder.save()
+
+ unlock_exclusive()
# This is executed in the site the host is assigned to.