Module: check_mk
Branch: master
Commit: a4bf209ae45b10d9748cc83dd6cf8df8991aba54
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a4bf209ae45b10…
Author: Alex Zurhake <az(a)mathias-kettner.de>
Date: Mon Mar 11 11:06:36 2019 +0100
FEED-3407: Use global variable instead of relative Path
Change-Id: I2cc1d8eaf89594854448f519d4630dfd22a01f89
---
omd/packages/check_mk/check_mk.make | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/omd/packages/check_mk/check_mk.make b/omd/packages/check_mk/check_mk.make
index 085beb7..3aa9298 100644
--- a/omd/packages/check_mk/check_mk.make
+++ b/omd/packages/check_mk/check_mk.make
@@ -14,7 +14,7 @@ $(CHECK_MK)-install: $(CHECK_MK_INSTALL)
# This step creates a tar archive containing the sources
# which are need for the build step
$(REPO_PATH)/$(DISTNAME).tar.gz:
- $(MAKE) -C ../../ $(DISTNAME).tar.gz ; \
+ $(MAKE) -C $(REPO_PATH) $(DISTNAME).tar.gz ; \
# The build step just extracts the archive
# which was created in the step before
Module: check_mk
Branch: master
Commit: 6532d60d84fab51115d5371f50ccbd58ff12a8e5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6532d60d84fab5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sun Mar 10 14:42:25 2019 +0100
7236 Deterministic rules.mk when "Use GIT version control for WATO" is enabled
When "Use GIT version control for WATO" is enabled to keep track of the changes
that have been made to the Check_MK configuration, the history of the rules.mk
files was problematic because several contents of that file were not saved in a
deterministic way. This means that loading and saving the configuration without
chaning anything resulted in a changed file, e.g. because attributes of
dictionaries were not sorted.
The rules.mk is now stored in a deterministic way when "Use GIT version control for WATO"
is enabled.
Change-Id: Ica1cf3e63e170ba4f61fbe521c9bb667070ad0bd
---
.werks/7236 | 18 ++++++++++++++++++
cmk/gui/watolib/rulesets.py | 23 +++++++++++++++--------
cmk/utils/store.py | 10 +++++++---
3 files changed, 40 insertions(+), 11 deletions(-)
diff --git a/.werks/7236 b/.werks/7236
new file mode 100644
index 0000000..c4eb842
--- /dev/null
+++ b/.werks/7236
@@ -0,0 +1,18 @@
+Title: Deterministic rules.mk when "Use GIT version control for WATO" is enabled
+Level: 1
+Component: wato
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1552225139
+Class: feature
+
+When "Use GIT version control for WATO" is enabled to keep track of the changes
+that have been made to the Check_MK configuration, the history of the rules.mk
+files was problematic because several contents of that file were not saved in a
+deterministic way. This means that loading and saving the configuration without
+chaning anything resulted in a changed file, e.g. because attributes of
+dictionaries were not sorted.
+
+The rules.mk is now stored in a deterministic way when "Use GIT version control for WATO"
+is enabled.
diff --git a/cmk/gui/watolib/rulesets.py b/cmk/gui/watolib/rulesets.py
index 7dcde5d..68a2a2e 100644
--- a/cmk/gui/watolib/rulesets.py
+++ b/cmk/gui/watolib/rulesets.py
@@ -25,10 +25,12 @@
# Boston, MA 02110-1301 USA.
import re
+import pprint
import cmk.utils.regex
import cmk.utils.store as store
+import cmk.gui.config as config
from cmk.gui.log import logger
from cmk.gui.globals import html
from cmk.gui.i18n import _
@@ -71,7 +73,7 @@ class RulesetCollection(object):
def _load_folder_rulesets(self, folder, only_varname=None):
path = folder.rules_file_path()
- config = {
+ config_dict = {
"ALL_HOSTS": ALL_HOSTS,
"ALL_SERVICES": [""],
"NEGATE": NEGATE,
@@ -85,11 +87,11 @@ class RulesetCollection(object):
for varname in rulespec_registry.keys():
if ':' in varname:
dictname, _subkey = varname.split(":")
- config[dictname] = {}
+ config_dict[dictname] = {}
else:
- config[varname] = []
+ config_dict[varname] = []
- self.from_config(folder, store.load_mk_file(path, config), only_varname)
+ self.from_config(folder, store.load_mk_file(path, config_dict), only_varname)
def from_config(self, folder, rulesets_config, only_varname=None):
for varname in rulespec_registry.keys():
@@ -125,7 +127,7 @@ class RulesetCollection(object):
content += ruleset.to_config(folder)
- store.save_mk_file(folder.rules_file_path(), content)
+ store.save_mk_file(folder.rules_file_path(), content, add_header=not config.wato_use_git)
def exists(self, name):
return name in self._rulesets
@@ -651,8 +653,12 @@ class Rule(object):
def to_config(self):
content = " ( "
+ # When using pprint we get a deterministic representation of the
+ # data structures because it cares about sorting of the dict keys
+ repr_func = pprint.pformat if config.wato_use_git else repr
+
if self.ruleset.valuespec():
- content += repr(self.value) + ", "
+ content += repr_func(self.value) + ", "
elif not self.value:
content += "NEGATE, "
@@ -686,8 +692,9 @@ class Rule(object):
else:
content += repr(self.item_list)
- if self.rule_options:
- content += ", %r" % self._rule_options_to_config()
+ rule_options = self._rule_options_to_config()
+ if rule_options:
+ content += ", %s" % repr_func(rule_options)
content += " ),\n"
diff --git a/cmk/utils/store.py b/cmk/utils/store.py
index 0b71ecd..376c527 100644
--- a/cmk/utils/store.py
+++ b/cmk/utils/store.py
@@ -120,9 +120,13 @@ def load_from_mk_file(path, key, default, **kwargs):
return load_mk_file(path, {key: default}, **kwargs)[key]
-def save_mk_file(path, mk_content):
- content = "# Written by Check_MK store (%s)\n\n" % \
- time.strftime("%Y-%m-%d %H:%M:%S")
+def save_mk_file(path, mk_content, add_header=True):
+ content = ""
+
+ if add_header:
+ content += "# Written by Check_MK store (%s)\n\n" % \
+ time.strftime("%Y-%m-%d %H:%M:%S")
+
content += mk_content
content += "\n"
save_file(path, content)
Module: check_mk
Branch: master
Commit: 8e4c32944cf17627b94ec0065427ae299b5c352a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8e4c32944cf176…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 8 12:07:05 2019 +0100
7233 Network scan: Multiple time ranges can be configured
The network scan can be configured to operate only in a specific time range.
With this change it is possible to define multiple independent time ranges.
Change-Id: I79a3e9c219f748f678d991d4b1bfde87b4565faa
---
.werks/7233 | 11 ++
cmk/gui/plugins/wato/builtin_attributes.py | 115 ++++++++++++---------
cmk/gui/watolib/hosts_and_folders.py | 46 +++++----
.../unit/cmk/gui/test_watolib_hosts_and_folders.py | 37 +++++++
4 files changed, 143 insertions(+), 66 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=8e4c32944c…