[omd-commits] OMD Git: omd: FIX: Reducing duplicate config writes during site creation

git version control git at mathias-kettner.de
Thu Jul 17 16:09:52 CEST 2014


Module:   omd
Branch:   master
Commit:   f98a4fcd7aedfceacf8d4db38ca87806581e653e
URL:      http://omdistro.org/projects/omd/repository/revisions/f98a4fcd7aedfceacf8d4db38ca87806581e653e

Author:   Lars Michelsen <lm at mathias-kettner.de>
Date:     Thu Jul 17 15:55:58 2014 +0200
Commiter: Lars Michelsen <lm at mathias-kettner.de>
Date:     Thu Jul 17 15:55:58 2014 +0200

FIX: Reducing duplicate config writes during site creation

---

 Changelog        |    1 +
 packages/omd/omd |   10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Changelog b/Changelog
index e8e6820..332f841 100644
--- a/Changelog
+++ b/Changelog
@@ -17,6 +17,7 @@ This file documents the revision history for the Open Monitoring Distribution
             - FIX: Providing correct exit codes when running "omd status"
             - FIX: exit with 2 (partially running) when only some of the
               sites are running or partially running using "omd status"
+            - FIX: Reducing duplicate config writes during site creation
           - diskspace: Fixed error messages in syslog which were caused by
             exit codes of 3 when diskspace cleanup has not been configured
           - Check_MK/MK Livestatus: new version 1.2.4p5
diff --git a/packages/omd/omd b/packages/omd/omd
index 43234ec..d580879 100644
--- a/packages/omd/omd
+++ b/packages/omd/omd
@@ -1900,9 +1900,9 @@ def config_set(args):
 
 def config_set_all():
     for hookname, hook in g_hooks.items():
-        config_set_value(hookname, hook["value"])
+        config_set_value(hookname, hook["value"], save = False)
 
-def config_set_value(hookname, value):
+def config_set_value(hookname, value, save = True):
     hook = g_hooks.get(hookname)
 
     # Call hook with 'set'. If it outputs something, that will
@@ -1915,7 +1915,9 @@ def config_set_value(hookname, value):
         value = answer.strip()
 
     hook["value"] = value
-    config_save()
+
+    if save:
+        config_save()
 
 def config_usage():
     sys.stdout.write("""Usage of config command:
@@ -2337,7 +2339,7 @@ def init_site(config_settings = None, apache_reload = False):
     config_set_all() # execute 'set' functions with default values
     if config_settings:
         for hookname, value in config_settings.items():
-            config_set_value(hookname, value)
+            config_set_value(hookname, value, save = False)
     config_save()
 
     # Change the few files that config save as created as root



More information about the omd-commits mailing list