Module: check_mk
Branch: master
Commit: c0156269de0415465b57d1e0e8025ba0de054714
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c0156269de0415…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Mar 5 10:10:15 2018 +0100
Moved most of the toplevel code into main().
Change-Id: If82377974d1763f46e0830d1521801841d7d67be
---
bin/mkeventd | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/bin/mkeventd b/bin/mkeventd
index c37a3d2..f9d1e1f 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -5043,9 +5043,8 @@ lock_logging = ECLock("history")
g_terminate_main_event = threading.Event()
-if __name__ == "__main__":
- # TODO(sp) Move all the stuff below in to a function so we don't have to
- # pollute the global namspace like hell.
+
+def main():
os.unsetenv("LANG")
settings = cmk.ec.settings.settings(cmk.__version__,
@@ -5079,6 +5078,7 @@ if __name__ == "__main__":
settings.paths.status_file.value.parent.mkdir(parents=True, exist_ok=True)
# First do all things that might fail, before daemonizing
+ global g_perfcounters, g_event_status, g_status_server, g_event_server
g_perfcounters = Perfcounters()
g_event_status = EventStatus(settings)
g_status_server = StatusServer(settings)
@@ -5156,3 +5156,7 @@ if __name__ == "__main__":
pid_path.unlink()
except OSError:
pass
+
+
+if __name__ == "__main__":
+ main()