Module: check_mk
Branch: master
Commit: 9a0fafc30f54e0e7f2af9ac1fa7a41136d2019d1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9a0fafc30f54e0…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Mar 3 09:49:25 2014 +0100
FIX Fix NoneType has not attribute userdb_automatic_sync bug in D-WATO
---
.werks/709 | 9 +++++++++
ChangeLog | 1 +
web/plugins/wato/userdb.py | 13 ++++++++++---
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/.werks/709 b/.werks/709
new file mode 100644
index 0000000..d50f91d
--- /dev/null
+++ b/.werks/709
@@ -0,0 +1,9 @@
+Title: Fix NoneType has not attribute userdb_automatic_sync bug in D-WATO
+Level: 1
+Component: wato
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1393836538
+
+
diff --git a/ChangeLog b/ChangeLog
index da48fa2..649a992 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -297,6 +297,7 @@
* 0690 FIX: Fix language jumping to German when saving user profiles
* 0666 FIX: Minimum port for the mknotifyd is now 1024 (never use well known
ports)...
* 0559 FIX: WATO snapshots: improved validation of (uploaded) snapshots...
+ * 0709 FIX: Fix NoneType has not attribute userdb_automatic_sync bug in D-WATO
Notifications:
* 0362 sms: now searching PATH for sendsms and smssend commands...
diff --git a/web/plugins/wato/userdb.py b/web/plugins/wato/userdb.py
index 43608fd..ff7a0ef 100644
--- a/web/plugins/wato/userdb.py
+++ b/web/plugins/wato/userdb.py
@@ -24,9 +24,16 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-import userdb
-
def sync_pre_activate_changes(_unused):
- if 'wato_pre_activate_changes' in config.userdb_automatic_sync:
+ # In some rare cases for still unknown reasons at this time the
+ # variable config sometimes has the value None. This could or could
+ # not be a mod_python problem. But it makes the activation of changes
+ # in a D-WATO setup break. So better handle this case here.
+ try:
+ do_sync = 'wato_pre_activate_changes' in config.userdb_automatic_sync
+ except:
+ do_sync = False
+ if do_sync:
userdb.hook_sync()
+
api.register_hook('pre-activate-changes', sync_pre_activate_changes)