Module: check_mk
Branch: master
Commit: 52b73dfb5510fa8cf877870429fdd960607ba71f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=52b73dfb5510fa…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 29 14:18:19 2013 +0100
LDAP: The sync hooks during activate changes can now be enabled/disabled
---
ChangeLog | 2 ++
web/plugins/config/builtin.py | 2 +-
web/plugins/wato/check_mk_configuration.py | 8 +++++---
web/plugins/wato/userdb.py | 11 +++++++++--
4 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 12cbcde..b32ba8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -101,6 +101,8 @@
* New option for full SNMP scan in bulk inventory
* bulk operations now also available when checkboxes are off
* LDAP: Added test to validate the configured role sync groups
+ * LDAP: The sync hooks during activate changes can now be enabled/disabled
+ by configuration (Global Settings)
* Disabled replication type "peer" in site editor.
* Added "permanently ignore" button to inventory services dialog which
links directly to the disabled services view
diff --git a/web/plugins/config/builtin.py b/web/plugins/config/builtin.py
index a51fab3..6d23c08 100644
--- a/web/plugins/config/builtin.py
+++ b/web/plugins/config/builtin.py
@@ -210,7 +210,7 @@ staleness_threshold = 1.5
#
user_connectors = ['htpasswd']
-userdb_automatic_sync = [ 'wato_users', 'page' ]
+userdb_automatic_sync = [ 'wato_users', 'page',
'wato_pre_activate_changes', 'wato_snapshot_pushed' ]
ldap_connection = {}
ldap_userspec = {}
ldap_groupspec = {}
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index d1ea01e..8bc5ba8 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -486,10 +486,12 @@ register_configvar(group,
'during each page rendering. Each connector can then specify if it
wants to perform '
'any actions. For example the LDAP connector will start the sync
once the cached user '
'information are too old.'),
- default_value = [ 'wato_users', 'page' ],
+ default_value = [ 'wato_users', 'page',
'wato_pre_activate_changes', 'wato_snapshot_pushed' ],
choices = [
- ('wato_users', 'When opening the users configuration page'),
- ('page', 'During regular page processing'),
+ ('page', 'During regular page
processing'),
+ ('wato_users', 'When opening the users
configuration page'),
+ ('wato_pre_activate_changes', 'Hook: Before activating the
changed configuration'),
+ ('wato_snapshot_pushed', 'Hook: On a remote site, when it
receives a new snapshot'),
],
allow_empty = True,
),
diff --git a/web/plugins/wato/userdb.py b/web/plugins/wato/userdb.py
index 9f1dddd..0d5663e 100644
--- a/web/plugins/wato/userdb.py
+++ b/web/plugins/wato/userdb.py
@@ -26,5 +26,12 @@
import userdb
-api.register_hook('pre-activate-changes', lambda hosts: userdb.hook_sync())
-api.register_hook('snapshot-pushed', userdb.hook_sync)
+def sync_pre_activate_changes(_unused):
+ if 'wato_pre_activate_changes' in config.userdb_automatic_sync:
+ userdb.hook_sync()
+api.register_hook('pre-activate-changes', sync_pre_activate_changes)
+
+def sync_snapshot_pushed():
+ if 'wato_snapshot_pushed' in config.userdb_automatic_sync:
+ userdb.hook_sync()
+api.register_hook('snapshot-pushed', sync_snapshot_pushed)