[omd-commits] OMD Git: omd: omd: new option --no-autostart, -A for omd create

git version control git at mathias-kettner.de
Tue Nov 27 14:34:49 CET 2012


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

Author:   Mathias Kettner <mk at mathias-kettner.de>
Date:     Wed Nov 14 10:06:11 2012 +0100
Commiter: Mathias Kettner <mk at mathias-kettner.de>
Date:     Wed Nov 14 10:06:11 2012 +0100

omd: new option --no-autostart, -A for omd create

---

 Changelog        |    2 ++
 packages/omd/omd |   13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index c996277..16fcf7c 100644
--- a/Changelog
+++ b/Changelog
@@ -6,6 +6,8 @@ This file documents the revision history for the Open Monitoring Distribution
          - Apache: Enabling mod_status (if available) for 127.0.0.1 in own mode
          - Check_MK/MK Livestatus: new version 1.2.0p3
          - NagVis: Update to 1.7.3
+         - omd: new option --no-autostart, -A for omd create (set AUTOSTART 
+           to off right at creation, useful for test sites!)
 
 0.56     Sep 25 2012
           - omd:
diff --git a/packages/omd/omd b/packages/omd/omd
index 0a6ef1a..34e8ada 100644
--- a/packages/omd/omd
+++ b/packages/omd/omd
@@ -2160,8 +2160,13 @@ def main_create(args, options={}):
         create_site_dir(g_sitename)
         add_to_fstab(g_sitename)
 
+    config_settings = {}
+    if "no-autostart" in options:
+        config_settings["AUTOSTART"] = "off"
+        sys.stdout.write("Going to set AUTOSTART to off.\n")
+
     if not "no-init" in options:
-        init_site()
+        init_site(config_settings)
         welcome_message()
 
     else:
@@ -2213,7 +2218,7 @@ def main_init(args, options):
     init_site()
     welcome_message()
 
-def init_site():
+def init_site(config_settings=None):
     # Create symbolic link to version
     create_version_symlink(g_sitename, OMD_VERSION)
 
@@ -2231,6 +2236,9 @@ def init_site():
     # Create site.conf with default values
     config_load_hooks()
     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_save()
 
     # Change the few files that config save as created as root
@@ -2839,6 +2847,7 @@ commands = [
       ( "gid", "g", True, "create site group with GID ARG" ),
       ( "reuse", None, False, "do not create a site user, reuse existing one" ),
       ( "no-init",  "n",  False, "leave new site directory empty (a later omd init does this"),
+      ( "no-autostart", "A", False, "set AUTOSTART to off (useful for test sites)"), 
     ],
     "Create a new site (-u UID, -g GID)",
 



More information about the omd-commits mailing list