Module: check_mk
Branch: master
Commit: fb1644cd1ce0a06c97cc554dc02841ce1407c10f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fb1644cd1ce0a0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Sep 28 10:29:06 2018 +0200
6772 FIX LDAP: Only save users on changed configuration
The LDAP synchronization was rewriting the user configuration during
every synchronization, even when no change has been made to the user
configuration.
This needless operation resulted in subsequent load because some
processes, like the Check_MK alert and notify helper were reloading
their configuration in case of a changed Check_MK config file.
Change-Id: I331028d50d7ea99b5f6c18ecdc555cbb437156ac
---
.werks/6772 | 17 +++++++++++++++++
cmk/gui/plugins/userdb/ldap_connector.py | 5 ++++-
cmk/gui/userdb.py | 6 +++++-
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/.werks/6772 b/.werks/6772
new file mode 100644
index 0000000..af71d52
--- /dev/null
+++ b/.werks/6772
@@ -0,0 +1,17 @@
+Title: LDAP: Only save users on changed configuration
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1538063535
+
+The LDAP synchronization was rewriting the user configuration during
+every synchronization, even when no change has been made to the user
+configuration.
+
+This needless operation resulted in subsequent load because some
+processes, like the Check_MK alert and notify helper were reloading
+their configuration in case of a changed Check_MK config file.
diff --git a/cmk/gui/plugins/userdb/ldap_connector.py
b/cmk/gui/plugins/userdb/ldap_connector.py
index bdf1cdf..8af2b1a 100644
--- a/cmk/gui/plugins/userdb/ldap_connector.py
+++ b/cmk/gui/plugins/userdb/ldap_connector.py
@@ -1103,7 +1103,10 @@ class LDAPUserConnector(UserConnector):
if changes and config.wato_enabled and not config.is_wato_slave_site():
watolib.add_change("edit-users",
"<br>\n".join(changes), add_user=False)
- userdb.save_users(users)
+ if changes:
+ userdb.save_users(users)
+ else:
+ userdb.release_users_lock()
self._set_last_sync_time()
diff --git a/cmk/gui/userdb.py b/cmk/gui/userdb.py
index 8d226ee..920382a 100644
--- a/cmk/gui/userdb.py
+++ b/cmk/gui/userdb.py
@@ -754,7 +754,7 @@ def save_users(profiles):
# Release the lock to make other threads access possible again asap
# This lock is set by load_users() only in the case something is expected
# to be written (like during user syncs, wato, ...)
- store.release_lock(root_dir + "contacts.mk")
+ release_users_lock()
# populate the users cache
# TODO: Can we clean this up?
@@ -764,6 +764,10 @@ def save_users(profiles):
hooks.call("users-saved", updated_profiles)
+def release_users_lock():
+ store.release_lock(root_dir + "contacts.mk")
+
+
# TODO: Isn't this needed only while generating the contacts.mk?
# Check this and move it to the right place
def _add_custom_macro_attributes(profiles):