Module: check_mk
Branch: master
Commit: bb87bbc6a98c48f17be49fcda5feaee80004ac01
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bb87bbc6a98c48…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 11 09:26:50 2016 +0200
3669 FIX LDAP: Fixed very long running LDAP sync when using group based sync plugins
---
.werks/3669 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/index.py | 14 +++++++++-----
web/htdocs/userdb.py | 28 ++++++++++++++++++++++++++--
4 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/.werks/3669 b/.werks/3669
new file mode 100644
index 0000000..45dca6b
--- /dev/null
+++ b/.werks/3669
@@ -0,0 +1,10 @@
+Title: LDAP: Fixed very long running LDAP sync when using group based sync plugins
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1468221930
+
+
diff --git a/ChangeLog b/ChangeLog
index a1d2e69..ad0a5c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -388,6 +388,7 @@
* 3659 FIX: Fixed GUI exceptions for users having special characters in ther user names
* 3662 FIX: Fixed creation/editing of dashboards (regression since 1.2.8p5)
* 3668 FIX: Fixed slow loading of GUI pages when using a localized GUI
+ * 3669 FIX: LDAP: Fixed very long running LDAP sync when using group based sync plugins
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node selection...
diff --git a/web/htdocs/index.py b/web/htdocs/index.py
index ab7342b..a99db40 100644
--- a/web/htdocs/index.py
+++ b/web/htdocs/index.py
@@ -30,6 +30,7 @@ import i18n
import sites
import livestatus
import modules
+import userdb
import defaults, config, login
from lib import *
from html_mod_python import html_mod_python, FinalizeRequest
@@ -173,9 +174,7 @@ def handler(req, fields = None, is_profiling = False):
except (apache.SERVER_RETURN,
(apache.SERVER_RETURN, apache.HTTP_UNAUTHORIZED),
(apache.SERVER_RETURN, apache.HTTP_MOVED_TEMPORARILY)):
- release_all_locks()
- sites.disconnect()
- html.finalize(is_error=True)
+ finalize_request(is_error=True)
raise
except Exception, e:
@@ -191,10 +190,15 @@ def handler(req, fields = None, is_profiling = False):
modules.get_handler("gui_crash")()
response_code = apache.OK
+ finalize_request()
+ return response_code
+
+
+def finalize_request(is_error=False):
release_all_locks()
+ userdb.finalize()
sites.disconnect()
- html.finalize()
- return response_code
+ html.finalize(is_error=is_error)
# Ajax-Functions want no HTML output in case of an error but
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index 2644f34..f81b872 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -35,7 +35,11 @@ loaded_with_language = False
# Custom user attributes
user_attributes = {}
builtin_user_attribute_names = []
+
+# Connection configuration
connection_dict = {}
+# Connection object dictionary
+g_connections = {}
# Load all userdb plugins
def load_plugins(force):
@@ -56,6 +60,10 @@ def load_plugins(force):
for connection in config.user_connections:
connection_dict[connection['id']] = connection
+ # Cleanup eventual still open connections
+ if g_connections:
+ g_connections.clear()
+
global loaded_with_language
if loaded_with_language == current_language and not force:
return
@@ -79,6 +87,12 @@ def load_plugins(force):
loaded_with_language = current_language
+# Cleans up at the end of a request: Cleanup eventual open connections
+def finalize():
+ if g_connections:
+ g_connections.clear()
+
+
# Returns a list of two part tuples where the first element is the unique
# connection id and the second element the connector specification dict
def get_connections(only_enabled=False):
@@ -133,9 +147,19 @@ def cleanup_connection_id(connection_id):
return connection_id
-# Returns the connector dictionary of the given id
+# Returns the connection object of the requested connection id. This function
+# maintains a cache that for a single connection_id only one object per request
+# is created.
def get_connection(connection_id):
- return dict(get_connections()).get(connection_id)
+ if connection_id in g_connections:
+ return g_connections[connection_id]
+
+ connection = dict(get_connections()).get(connection_id)
+
+ if connection:
+ g_connections[connection_id] = connection
+
+ return connection
# Returns a list of connection specific locked attributes
Module: check_mk
Branch: master
Commit: eae3370390aa643011c773d22ac9179e42187324
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eae3370390aa64…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 8 15:39:54 2016 +0200
3668 FIX Fixed slow loading of GUI pages when using a localized GUI
---
.werks/3668 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/i18n.py | 1 +
web/htdocs/index.py | 4 ++--
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.werks/3668 b/.werks/3668
new file mode 100644
index 0000000..871c988
--- /dev/null
+++ b/.werks/3668
@@ -0,0 +1,10 @@
+Title: Fixed slow loading of GUI pages when using a localized GUI
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1467985155
+
+
diff --git a/ChangeLog b/ChangeLog
index 9922844..a1d2e69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -387,6 +387,7 @@
* 3148 FIX: fixed Edit View/Dashlet Dialogs offering non-sensical filter choices...
* 3659 FIX: Fixed GUI exceptions for users having special characters in ther user names
* 3662 FIX: Fixed creation/editing of dashboards (regression since 1.2.8p5)
+ * 3668 FIX: Fixed slow loading of GUI pages when using a localized GUI
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node selection...
diff --git a/web/htdocs/i18n.py b/web/htdocs/i18n.py
index d9f8ede..e1a3c6e 100644
--- a/web/htdocs/i18n.py
+++ b/web/htdocs/i18n.py
@@ -109,6 +109,7 @@ def init_language(lang, domain="multisite", locale_path=None):
# Prepares the builtin-scope for localization, registers the _() function and
# current_language variable. Is also used to disable localization
def unlocalize():
+ # TODO: Make behaviour like gettext _(): Always return unicode strings
__builtin__._ = lambda x: x
__builtin__.current_language = None
diff --git a/web/htdocs/index.py b/web/htdocs/index.py
index 7f38224..ab7342b 100644
--- a/web/htdocs/index.py
+++ b/web/htdocs/index.py
@@ -43,7 +43,6 @@ def handler(req, fields = None, is_profiling = False):
response_code = apache.OK
try:
- i18n.initialize()
config.load_config() # load multisite.mk etc.
init_profiling(is_profiling)
html.init_modes()
@@ -108,12 +107,13 @@ def handler(req, fields = None, is_profiling = False):
# Initialize the multiste i18n. This will be replaced by
# language settings stored in the user profile after the user
# has been initialized
+ previous_language = current_language
i18n.localize(html.var("lang", config.get_language()))
# All plugins might have to be reloaded due to a language change. Only trigger
# a second plugin loading when the user is really using a custom localized GUI.
# Otherwise the load_all_plugins() at the beginning of the request is sufficient.
- if current_language != None:
+ if current_language != previous_language:
modules.load_all_plugins()
# User allowed to login at all?
Module: check_mk
Branch: master
Commit: 485765d8c338d60af0662ce85a9683006236bb83
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=485765d8c338d6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 8 14:15:21 2016 +0200
3667 Search expressions in host search can now be given as regexes
The host search in WATO is normally performing a case insensitive infix search on the
set text attributes (e.g. name, alias, IP addresses). Now you can specify regular expressions
by prefixing the search term with a <tt>~</tt>. The regex searches are also performed as
case insensitive infix searches.
---
.werks/3667 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/watolib.py | 8 +++++++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/.werks/3667 b/.werks/3667
new file mode 100644
index 0000000..585687e
--- /dev/null
+++ b/.werks/3667
@@ -0,0 +1,12 @@
+Title: Search expressions in host search can now be given as regexes
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.4.0i1
+Date: 1467979934
+Class: feature
+
+The host search in WATO is normally performing a case insensitive infix search on the
+set text attributes (e.g. name, alias, IP addresses). Now you can specify regular expressions
+by prefixing the search term with a <tt>~</tt>. The regex searches are also performed as
+case insensitive infix searches.
diff --git a/ChangeLog b/ChangeLog
index b78be88..9922844 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -405,6 +405,7 @@
* 3657 Custom host attributes can now be configured...
* 3658 LDAP: Connections can now be enabled/disabled per site...
* 3553 SNMPv3 noAuthNoPriv: Fixed diagnostic page
+ * 3667 Search expressions in host search can now be given as regexes...
* 3060 FIX: Folder properties: Fixed exception when a user has no alias set...
* 3062 FIX: Git integration: Fixed not adding files in WATO folders to git control
* 3203 FIX: Distributed WATO: Fixed exception in remote host service discovery...
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 9e72fd5..730d1ce 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -2466,7 +2466,13 @@ class TextAttribute(Attribute):
def filter_matches(self, crit, value, hostname):
if value == None: # Host does not have this attribute
value = ""
- return crit.lower() in value.lower()
+
+ if crit[0] == "~":
+ # insensitive infix regex match
+ return re.search(crit[1:], value, re.IGNORECASE) != None
+ else:
+ # insensitive infix search
+ return crit.lower() in value.lower()
# A simple text attribute that is not editable by the user.
# It can be used to store context information from other