Module: check_mk
Branch: master
Commit: f6471bb41930aef3cc19bcde9f41b8b6cd769ae0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f6471bb41930ae…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Sep 20 13:35:25 2016 +0200
Write notification spoolfiles into temporary file (before allowing mknotifyd to process
it)
---
modules/notify.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules/notify.py b/modules/notify.py
index 43bab3f..34df6b3 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -1212,7 +1212,10 @@ def create_spoolfile(data):
os.makedirs(notification_spooldir)
file_path = "%s/%s" % (notification_spooldir, fresh_uuid())
notify_log("Creating spoolfile: %s" % file_path)
- file(file_path,"w").write(pprint.pformat(data))
+
+ # First write into tempfile that is not handled by mknotifyd
+ file(file_path + ".new", "w").write(pprint.pformat(data))
+ os.rename(file_path + ".new", file_path)
# There are three types of spool files: