Module: check_mk
Branch: master
Commit: dfac05b9ec64406edb6a4593e2d0d9589d7e5dcb
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dfac05b9ec6440…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Tue Jul 17 10:10:40 2018 +0200
Remove BasicItemState test from MockItemState
Unfortunately, we can't be that strict. It would
break at least logwatch.
Change-Id: Ie53c866724f3a178a6e264b91bd682deb7a575cb
---
tests/unit/checks/checktestlib.py | 41 ++++++++++-----------------------------
1 file changed, 10 insertions(+), 31 deletions(-)
diff --git a/tests/unit/checks/checktestlib.py b/tests/unit/checks/checktestlib.py
index 263e3a8..cc29f23 100644
--- a/tests/unit/checks/checktestlib.py
+++ b/tests/unit/checks/checktestlib.py
@@ -319,21 +319,18 @@ class MockItemState(object):
There are three different types of arguments to pass to MockItemState:
- 1) Tuple or a BasicItemState:
- The argument is assumed to be (time_diff, value). All calls to the
- item_state API behave as if the last state had been `value`, recorded
- `time_diff` seeconds ago.
+ 1) Callable object:
+ The callable object will replace `get_item_state`. It must accept two
+ arguments (key/default), in same way a dictionary does.
- 2) Dictionary containing Tuples or BasicItemStates:
+ 2) Dictionary:
The dictionary will replace the item states.
Basically `get_item_state` gets replaced by the dictionarys GET method.
- 3) Callable object:
- The callable object will replace `get_item_state`. It must accept two
- arguments (key/default), in same way a dictionary does.
-
- In all of these cases, the sanity of the returned values is checked
- (i.e. they have to be BasicItemState).
+ 3) Anything else:
+ All calls to the item_state API behave as if the last state had
+ been `value`, recorded
+ `time_diff` seeconds ago.
See for example 'test_statgrab_cpu_check.py'.
"""
@@ -347,34 +344,16 @@ class MockItemState(object):
self.get_val_function = mock_state
return
- type_mock_state = type(mock_state)
- allowed_types = (tuple, BasicItemState, dict)
- assert type_mock_state in allowed_types, \
- "MockItemState: state %r must be of type %r, or callable - not %r" % \
- (mock_state, allowed_types, type_mock_state)
-
# in dict case check values
- if type_mock_state == dict:
- msg = "MockItemState: dict value %r must be in of type %r - not %r"
- allowed_types = (tuple, BasicItemState)
- for v in mock_state.values():
- tyv = type(v)
- assert tyv in allowed_types, msg % (v, allowed_types, tyv)
+ if isinstance(mock_state, dict):
self.get_val_function = mock_state.get
else:
self.get_val_function = lambda key, default: mock_state
def __call__(self, user_key, default=None):
- if default is not None:
- # ensure the default value is sane
- default = BasicItemState(default)
val = self.get_val_function(user_key, default)
- if val is None:
- return val
- if not isinstance(val, BasicItemState):
- val = BasicItemState(val)
- return val.time_diff, val.value
+ return val
def __enter__(self):
'''The default context: just mock get_item_state'''
Module: check_mk
Branch: master
Commit: 3e07d2ee22db7c85c2054c75d6d7869135482383
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e07d2ee22db7c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 26 09:57:50 2018 +0200
6352 FIX Fixed "Sync with LDAP connections" default for new sites
When a new monitoring site is create using WATO it was intended to
set the option "Sync with LDAP connections" to make the site not
perform an LDAP sync on it's own.
We assume that new sites will be added as WATO slave site in most
cases. In this scenario you normally don't want to let the slave
sites synchronize on their own because the synchronization would
produce pending changes on the slave site. These pending changes
will prevent future synchronizations from the master site and need
to be confirmed manually on the slave site to be able to sync again.
In previous versions the new sites were configured to synchronize
with LDAP on their own by default. It's recommended to change this
option to the intended default.
However, there are scenarios were it makes sense to set this option
to also perform the synchronization on the slave site with either
all configured LDAP connections or just some connections.
Change-Id: Iaa23361eb7207c16f7070d1fbf78cb36a4f2d854
---
.werks/6352 | 28 ++++++++++++++++++++++++++++
cmk/gui/wato/pages/sites.py | 2 +-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/.werks/6352 b/.werks/6352
new file mode 100644
index 0000000..b83e2b2
--- /dev/null
+++ b/.werks/6352
@@ -0,0 +1,28 @@
+Title: Fixed "Sync with LDAP connections" default for new sites
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1531893317
+
+When a new monitoring site is create using WATO it was intended to
+set the option "Sync with LDAP connections" to make the site not
+perform an LDAP sync on it's own.
+
+We assume that new sites will be added as WATO slave site in most
+cases. In this scenario you normally don't want to let the slave
+sites synchronize on their own because the synchronization would
+produce pending changes on the slave site. These pending changes
+will prevent future synchronizations from the master site and need
+to be confirmed manually on the slave site to be able to sync again.
+
+In previous versions the new sites were configured to synchronize
+with LDAP on their own by default. It's recommended to change this
+option to the intended default.
+
+However, there are scenarios were it makes sense to set this option
+to also perform the synchronization on the slave site with either
+all configured LDAP connections or just some connections.
diff --git a/cmk/gui/wato/pages/sites.py b/cmk/gui/wato/pages/sites.py
index 32703e9..e541e97 100644
--- a/cmk/gui/wato/pages/sites.py
+++ b/cmk/gui/wato/pages/sites.py
@@ -673,7 +673,7 @@ class ModeEditSite(ModeSites):
forms.section(_("Sync with LDAP connections"), simple=True)
self._site_mgmt.user_sync_valuespec().render_input("user_sync",
- self._site.get("user_sync", userdb.user_sync_default_config(self._site_id)))
+ self._site.get("user_sync", None if self._new else userdb.user_sync_default_config(self._site_id)))
html.br()
html.help(_('By default the users are synchronized automatically in the interval configured '
'in the connection. For example the LDAP connector synchronizes the users every '
Module: check_mk
Branch: master
Commit: dae7dafa82b3a4288c494e77159d0e8466db31bc
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dae7dafa82b3a4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 26 10:00:31 2018 +0200
6353 FIX LDAP sync: Do not add a pending change when sync is executed on slave sites
To prevent synchronization problems from WATO master to slave sites when a remote
LDAP sync is performed we don't create pending change entries on the slave
sites anymore when user changes are made by the automatic synchronization.
Change-Id: I9e7e384f37915f2faf038ac7b98bd1634a794d21
---
.werks/6353 | 13 +++++++++++++
cmk/gui/plugins/userdb/ldap_connector.py | 4 ++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/.werks/6353 b/.werks/6353
new file mode 100644
index 0000000..456981a
--- /dev/null
+++ b/.werks/6353
@@ -0,0 +1,13 @@
+Title: LDAP sync: Do not add a pending change when sync is executed on slave sites
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1531895586
+
+To prevent synchronization problems from WATO master to slave sites when a remote
+LDAP sync is performed we don't create pending change entries on the slave
+sites anymore when user changes are made by the automatic synchronization.
diff --git a/cmk/gui/plugins/userdb/ldap_connector.py b/cmk/gui/plugins/userdb/ldap_connector.py
index f4a834f..c221939 100644
--- a/cmk/gui/plugins/userdb/ldap_connector.py
+++ b/cmk/gui/plugins/userdb/ldap_connector.py
@@ -1119,8 +1119,8 @@ class LDAPUserConnector(UserConnector):
duration = time.time() - start_time
self._logger.info('SYNC FINISHED - Duration: %0.3f sec', duration)
- if changes:
- import cmk.gui.watolib as watolib # TODO: Cleanup
+ import cmk.gui.watolib as watolib # TODO: Cleanup
+ if changes and not config.is_wato_slave_site():
watolib.add_change("edit-users", "<br>\n".join(changes), add_user=False)
userdb.save_users(users)
Module: check_mk
Branch: master
Commit: ea14696c687a72bd98bab784264bb4de86aeaa04
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ea14696c687a72…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Jul 26 09:19:06 2018 +0200
Fixed typo
Change-Id: Icbac1fdeebc57e563bf975e8cdf9a336beda6376
---
cmk_base/data_sources/__init__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmk_base/data_sources/__init__.py b/cmk_base/data_sources/__init__.py
index 6da2763..d6b67c5 100644
--- a/cmk_base/data_sources/__init__.py
+++ b/cmk_base/data_sources/__init__.py
@@ -281,13 +281,13 @@ class DataSources(object):
# Special agents can produce data for the same check_plugin_name on the same host, in this case
# the section lines need to be extended
multi_host_sections = MultiHostSections()
- for this_hostname, this_ipaddress, these_sources, this_max_cachfile_age in hosts:
+ for this_hostname, this_ipaddress, these_sources, this_max_cachefile_age in hosts:
# In case a max_cachefile_age is given with the function call, always use this one
# instead of the host individual one. This is only used in discovery mode.
if max_cachefile_age is not None:
these_sources.set_max_cachefile_age(max_cachefile_age)
else:
- these_sources.set_max_cachefile_age(this_max_cachfile_age)
+ these_sources.set_max_cachefile_age(this_max_cachefile_age)
for source in these_sources.get_data_sources():
host_sections_from_source = source.run()
Module: check_mk
Branch: master
Commit: 8eddf44b03451b20c616e458eccf5f9f65cf0ff7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8eddf44b03451b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jul 26 08:52:40 2018 +0200
6368 FIX Custom color sets are only used by classic theme
The configurable color set which can be configured in the
global settings of the CME are only used for the classic
GUI theme and does not apply to the new facelift theme.
Change-Id: Ib8ae736d77fc80b9ba66d405b31f1e3d8d77abc6
---
.werks/6368 | 13 +++++++++++++
cmk/gui/htmllib.py | 9 ++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/.werks/6368 b/.werks/6368
new file mode 100644
index 0000000..d7fd862
--- /dev/null
+++ b/.werks/6368
@@ -0,0 +1,13 @@
+Title: Custom color sets are only used by classic theme
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cme
+State: unknown
+Version: 1.6.0i1
+Date: 1532585864
+
+The configurable color set which can be configured in the
+global settings of the CME are only used for the classic
+GUI theme and does not apply to the new facelift theme.
diff --git a/cmk/gui/htmllib.py b/cmk/gui/htmllib.py
index 2b8df33..7f13844 100644
--- a/cmk/gui/htmllib.py
+++ b/cmk/gui/htmllib.py
@@ -1786,15 +1786,14 @@ class html(HTMLGenerator):
if config.custom_style_sheet:
self.write('<link rel="stylesheet" type="text/css" href="%s">\n' % config.custom_style_sheet)
- if cmk.is_managed_edition():
- import cmk.gui.cme.gui_colors as gui_colors
- gui_colors.GUIColors().render_html()
-
-
if self._theme and self._theme != "classic":
fname = self._css_filename_for_browser("themes/%s/theme" % self._theme)
self.stylesheet(fname)
+ elif cmk.is_managed_edition():
+ import cmk.gui.cme.gui_colors as gui_colors
+ gui_colors.GUIColors().render_html()
+
def _plugin_stylesheets(self):
plugin_stylesheets = set([])