Module: check_mk
Branch: master
Commit: 3462e182cbc80434f63b4bc1fc134258682df3da
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3462e182cbc804…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Aug 1 10:46:10 2017 +0200
5049 omd config: New mode "change" for bulk changing config options
It is now possible to change multiple configuration settings via command
line using the command "omd config change". This can be used like this:
echo -e "CORE=cmc\nAUTOSTART=on" | omd config change
The site is restarted automatically once in case it's currently runnig.
Change-Id: I5f13d6a0505a967622501937f7738f591028d808
---
.werks/5049 | 15 +++++++++++++++
omd/packages/omd/omd | 9 ++++++++-
omd/packages/omd/omd.8 | 14 +++++++++++++-
3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/.werks/5049 b/.werks/5049
new file mode 100644
index 0000000..c83cdca
--- /dev/null
+++ b/.werks/5049
@@ -0,0 +1,15 @@
+Title: omd config: New mode "change" for bulk changing config options
+Level: 1
+Component: omd
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1501577104
+Class: feature
+
+It is now possible to change multiple configuration settings via command
+line using the command "omd config change". This can be used like this:
+
+echo -e "CORE=cmc\nAUTOSTART=on" | omd config change
+
+The site is restarted automatically once in case it's currently runnig.
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index 95c1e19..cbf591f 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -1960,7 +1960,11 @@ def config_change():
def read_config_change_commands():
settings = []
- for line in sys.stdin.read():
+ for l in sys.stdin:
+ line = l.strip()
+ if not line:
+ continue
+
try:
key, value = line.split("=", 1)
settings.append((key, value))
@@ -2065,6 +2069,9 @@ omd config - interactive configuration menu
omd config show - show current settings of all configuration variables
omd config show VAR - show current setting of variable VAR
omd config set VAR VALUE - set VAR to VALUE
+omd config change - change multiple at once. Provide newline separated
+ KEY=value pairs via stdin. The site is restarted
+ automatically once in case it's currently runnig.
""")
def config_show(args):
diff --git a/omd/packages/omd/omd.8 b/omd/packages/omd/omd.8
index 29a0d6e..892191b 100644
--- a/omd/packages/omd/omd.8
+++ b/omd/packages/omd/omd.8
@@ -316,7 +316,7 @@ format.
If you add the option \fB--auto\fP then only the status of those sites will
be displayed, that are set to {AUTOSTART} = {on}.
.TP
-.B omd config [-f, --force] [SITE] [set|show] [VARIABLE] [VALUE]
+.B omd config [-f, --force] [SITE] [set|show|change] [VARIABLE] [VALUE]
This command is used to view and change the configuration of a site. Each
site has a list of configuration variables. Those variables configure
how the addons of the site should work together. Optional addons can be
@@ -341,6 +341,18 @@ The option \fB--force\fP will automatically stop the site in case
it is running before the config change is done and start it afterwards
again.
+In addition to \fBomd config set\fP there is this option to set multiple
+variables at once:
+
+\fBomd config [SITE] change\fP
+
+To change configuration options, you need to provide newline separated
+KEY=value pairs via stdin, for example like this:
+
+\fBecho -e "CORE=cmc\\nAUTOSTART=on" | omd config change\fP
+
+The site is restarted automatically once in case it's currently runnig.
+
.TP
.B omd [-v] diff [RELBASE] [-b, --bare]
Shows the differences of files in the current site compared to the files