Module: check_mk
Branch: master
Commit: a11b5134288a8b043bfe3bb240000afc509027bd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a11b5134288a8b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 25 11:38:11 2016 +0100
Fixed possible exception when trying to transform dashboards
---
web/htdocs/dashboard.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 7d00b29..b350d66 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -31,6 +31,7 @@ import wato
loaded_with_language = False
builtin_dashboards = {}
+builtin_dashboards_transformed = False
dashlet_types = {}
# Declare constants to be used in the definitions of the dashboards
@@ -57,8 +58,8 @@ def load_plugins(force):
# Load plugins for dashboards. Currently these files
# just may add custom dashboards by adding to builtin_dashboards.
- load_web_plugins("dashboard", globals())
builtin_dashboards_transformed = False
+ load_web_plugins("dashboard", globals())
# This must be set after plugin loading to make broken plugins raise
# exceptions all the time and not only the first time (when the plugins
Module: check_mk
Branch: master
Commit: 7fcd499a8a095c572131ff94bbf7d14bcbe8d627
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7fcd499a8a095c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 25 10:39:59 2016 +0100
Datetime valuespec can now optinally handle empty input and result in None
---
web/htdocs/htmllib.py | 5 ++++-
web/htdocs/valuespec.py | 9 ++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 15ed9b0..4ee35fa 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -529,8 +529,11 @@ class html(GUITester):
self.write(r'''onmouseover='this.style.backgroundImage="url(\"images/contextlink%s_hi.png\")";' ''' % what)
self.write(r'''onmouseout='this.style.backgroundImage="url(\"images/contextlink%s.png\")";' ''' % what)
+
def number_input(self, varname, deflt = "", size=8, style="", submit=None):
- self.text_input(varname, str(deflt), "number", size=size, style=style, submit=submit)
+ if deflt != None:
+ deflt = str(deflt)
+ self.text_input(varname, deflt, "number", size=size, style=style, submit=submit)
# Needed if input elements are put into forms without the helper
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index c691b3c..3ffb467 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -1935,7 +1935,7 @@ class RelativeDate(OptionalDropdownChoice):
# A ValueSpec for editing a date. The date is
# represented as a UNIX timestamp x where x % seconds_per_day
-# is zero (or will be ignored if non-zero), as long es
+# is zero (or will be ignored if non-zero), as long as
# include_time is not set to True
class AbsoluteDate(ValueSpec):
def __init__(self, **kwargs):
@@ -1946,6 +1946,11 @@ class AbsoluteDate(ValueSpec):
self._format = kwargs.get("format", self._include_time and "%F %T" or "%F")
self._default_value = kwargs.get("default_value", None)
self._allow_empty = kwargs.get('allow_empty', False)
+ # The default is that "None" means show current date/time in the
+ # input fields. This option changes the input fields to be empty by default
+ # and makes the value able to be None when no time is set.
+ # FIXME: Shouldn't this be the default?
+ self._none_means_empty = kwargs.get("none_means_empty", False)
def default_value(self):
if self._default_value != None:
@@ -1963,6 +1968,8 @@ class AbsoluteDate(ValueSpec):
return self.default_value()
def split_date(self, value):
+ if self._none_means_empty and value == None:
+ return (None,) * 6
lt = time.localtime(value)
return lt.tm_year, lt.tm_mon, lt.tm_mday, \
lt.tm_hour, lt.tm_min, lt.tm_sec
Module: check_mk
Branch: master
Commit: 77c71adb65c268ca28981cd4d846e09a5f419d19
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=77c71adb65c268…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 22 17:10:30 2016 +0100
#2947 FIX LDAP: Simplified automatic sync logic
By default once an LDAP connection has been configured the LDAP synchronization
was performed automatically in background in different situations:
<ul>
<li>During regular page processing (every 5 minutes)</li>
<li>When opening the users configuration page</li>
<li>Before activating the changed configuration</li>
<li>On a remote site, when it receives a new configuration</li>
</ul>
This was configuable using the config option <i>Automatic User Synchronization</i>.
One problem with the default configuration was that it enabled the
sync also for slave sites in distributed environments. Having the
sync enabled on a slave site a change in LDAP would trigger a change
on the slave site which is then preventing further activating of
changes from the master. One had to drop this change entry manually
to solve this situation.
Another problem was that such LDAP sync was executed in some kind
of random way when any HTTP request could trigger it. This felt odd
in cases where the LDAP sync could take a longer time when for example
saving of a view took 50 seconds instead of less than one second.
The sync during activating of the configuration was slowing down the
workflow when the sync took longer.
So we decided to change the automatic user synchronization to work
this way now:
It is now scheduled by the generic multisite cron job which is executed
once a minute. The LDAP sync then triggered and starts when the previous
synchronization has finished more than 5 minutes before. This interval
can still be configured for each LDAP connection.
The new default configuration is that the automatic LDAP synchronization
is performed only on the master site in distributed setups. But you can
change the option <i>Automatic User Synchronization</i> to either <i>On
all sites</i> to make it be executed on all your sites or completely
disable the automatic synchronization.
You have the option to change this setting for individual sites using
the site specific global settings.
Once at least one LDAP connection is configured the <i>Sync Users</i>
button is shown on the users page. It can be used to trigger the
user synchronization manually.
---
.werks/2947 | 56 ++++++++++++++++
ChangeLog | 1 +
web/htdocs/index.py | 10 +--
web/htdocs/userdb.py | 71 ++++++++++++++++++---
web/htdocs/wato.py | 20 +++---
web/plugins/config/builtin.py | 2 +-
web/plugins/{wato/userdb.py => cron/user_sync.py} | 14 +---
web/plugins/userdb/ldap.py | 4 +-
web/plugins/wato/check_mk_configuration.py | 31 ++++-----
9 files changed, 148 insertions(+), 61 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=77c71adb65…
Module: check_mk
Branch: master
Commit: 643525cdb88233f87e21e4a07c850d6087c140a3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=643525cdb88233…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 22 15:47:08 2016 +0100
#2946 FIX LDAP: User created during login does not trigger full user synchronisation anymore
Previously, when a LDAP user logged in for the first time and the user was not created
by an LDAP sync before, it triggered a full LDAP sync which might have created a lot
of other users. This has been changed now to only synchronize this single user based
on the sync configuration.
---
.werks/2946 | 12 ++++++++++++
ChangeLog | 1 +
web/plugins/userdb/ldap.py | 8 +++-----
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/.werks/2946 b/.werks/2946
new file mode 100644
index 0000000..62ba8ed
--- /dev/null
+++ b/.werks/2946
@@ -0,0 +1,12 @@
+Title: LDAP: User created during login does not trigger full user synchronisation anymore
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453473922
+Class: fix
+
+Previously, when a LDAP user logged in for the first time and the user was not created
+by an LDAP sync before, it triggered a full LDAP sync which might have created a lot
+of other users. This has been changed now to only synchronize this single user based
+on the sync configuration.
diff --git a/ChangeLog b/ChangeLog
index eb42ac9..c11edbe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -240,6 +240,7 @@
* 2904 FIX: Improved error handling when custom url dashlets raise an exception...
* 2830 FIX: Improved sorting in view column "Services colored according to state"...
* 2945 FIX: LDAP: Fixed broken sync for LDAP connections named "ldap"...
+ * 2946 FIX: LDAP: User created during login does not trigger full user synchronisation anymore...
WATO:
* 2442 WATO remove host: improved cleanup of obsolete host files...
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index f2ce5a0..8423536 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -906,11 +906,6 @@ class LDAPUserConnector(UserConnector):
self.log('SYNC STARTED')
self.log(' SYNC PLUGINS: %s' % ', '.join(self._config['active_plugins'].keys()))
- # Unused at the moment, always sync all users
- #filt = None
- #if only_username:
- # filt = '(%s=%s)' % (self.user_id_attr(), only_username)
-
ldap_users = self.get_users()
import wato
@@ -939,6 +934,9 @@ class LDAPUserConnector(UserConnector):
mode_create, user = load_user(user_id)
user_connection_id = cleanup_connection_id(user.get('connector'))
+ if only_username and user_id != only_username:
+ continue # Only one user should be synced, skip others.
+
# Name conflict: Found a user that has an equal name, but is not controlled
# by this connector. Don't sync it. When an LDAP connection suffix is configured
# use this for constructing a unique username. If not or if the name+suffix is