Module: check_mk
Branch: master
Commit: 5fe3b320354447968868314148299ff127d586f3
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5fe3b320354447…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon May 14 12:31:00 2018 +0200
Simplify predicate handling for filters.
Change-Id: I67078ec38765c0979307bd9d03e97002ff4a5ece
---
cmk/ec/main.py | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index bfcb7b4..a080583 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -972,7 +972,7 @@ def get_event_history_from_mongodb(settings, table_events, query, mongodb):
# Construct the mongodb filtering specification. We could fetch all information
# and do filtering on this data, but this would be way too inefficient.
query = {}
- for column_name, operator_name, _operator_function, argument in filters:
+ for column_name, operator_name, _predicate in filters:
if operator_name == '=':
mongo_filter = argument
@@ -1187,7 +1187,7 @@ def get_event_history_from_file(settings, table_history, query, logger):
'event_core_host',
]
greptexts = []
- for column_name, operator_name, _operator_function, argument in filters:
+ for column_name, operator_name, _predicate in filters:
# Make sure that the greptexts are in the same order as in the
# actual logfiles. They will be joined with ".*"!
try:
@@ -1222,10 +1222,10 @@ def get_event_history_from_file(settings, table_history, query, logger):
if limit is not None and limit <= 0:
break
first_entry, last_entry = get_logfile_timespan(path)
- for _column_name, _operator_name, operator_function, argument in time_filters:
- if operator_function(first_entry, argument):
+ for _column_name, _operator_name, predicate in time_filters:
+ if predicate(first_entry):
break
- if operator_function(last_entry, argument):
+ if predicate(last_entry):
break
else:
# If no filter matches but we *have* filters
@@ -3253,13 +3253,13 @@ class QueryGET(Query):
self.requested_columns = argument.split(" ")
elif header == "Filter":
- column_name, operator_name, operator_function, argument = self._parse_filter(argument)
+ column_name, operator_name, predicate = self._parse_filter(argument)
# Needed for later optimization (check_mkevents)
if column_name == "event_host" and operator_name == 'in':
self.only_host = set(argument)
- self.filters.append((column_name, operator_name, operator_function, argument))
+ self.filters.append((column_name, operator_name, predicate))
elif header == "Limit":
self.limit = int(argument)
@@ -3301,7 +3301,7 @@ class QueryGET(Query):
if not operator_function:
raise MKClientError("Unknown filter operator '%s'" % operator_name)
- return (column, operator_name, operator_function, argument)
+ return (column, operator_name, lambda x: operator_function(x, argument))
def requested_column_indexes(self):
indexes = []
@@ -3417,8 +3417,8 @@ class StatusTable(object):
return result_row
def filter_row(self, query, row):
- for column_name, _operator_name, operator_function, argument in query.filters:
- if not operator_function(row[query.table.column_indices[column_name]], argument):
+ for column_name, _operator_name, predicate in query.filters:
+ if not predicate(row[query.table.column_indices[column_name]]):
return None
return row
Module: check_mk
Branch: master
Commit: d90da4c38b4841a6a6d936893f4f45d35ae3a5df
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d90da4c38b4841…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon May 14 11:17:57 2018 +0200
Moved grep filter table to a smaller scope.
Change-Id: Ic9f9d3d4d474fc6ef8fd92b6d6d5ff1535c8abef
---
cmk/ec/main.py | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index a5f54cf..78f3c28 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -143,20 +143,6 @@ class SyslogFacility(object):
return "(unknown facility %d)" % self.value
-grepping_filters = [
- 'event_text',
- 'event_comment',
- 'event_host',
- 'event_host_regex',
- 'event_contact',
- 'event_application',
- 'event_rule_id',
- 'event_owner',
- 'event_ipaddress',
- 'event_core_host',
-]
-
-
# Alas, we often have no clue about the actual encoding, so we have to guess:
# Initially we assume UTF-8, but fall back to latin-1 if it didn't work.
def decode_from_bytes(string_as_bytes):
@@ -1188,6 +1174,18 @@ def get_event_history_from_file(settings, table_history, query, logger):
# Optimization: use grep in order to reduce amount
# of read lines based on some frequently used filters.
+ grepping_filters = [
+ 'event_text',
+ 'event_comment',
+ 'event_host',
+ 'event_host_regex',
+ 'event_contact',
+ 'event_application',
+ 'event_rule_id',
+ 'event_owner',
+ 'event_ipaddress',
+ 'event_core_host',
+ ]
greptexts = []
for filter_name, opfunc, args in filters:
# Make sure that the greptexts are in the same order as in the
Module: check_mk
Branch: master
Commit: 6815c92475f22b706a629500b78c8b09bd558ce1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6815c92475f22b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 14 11:35:24 2018 +0200
6089 FIX Download agent page: Only link to rule sets in case the user is permitted to access it
Change-Id: If58e0fc19f61aa6f3fc7f68f0d5b58a2c8d15fa8
---
.werks/6089 | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/.werks/6089 b/.werks/6089
new file mode 100644
index 0000000..bf0c7f9
--- /dev/null
+++ b/.werks/6089
@@ -0,0 +1,11 @@
+Title: Download agent page: Only link to rule sets in case the user is permitted to access it
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.6.0i1
+Date: 1526290491
+
+
Module: check_mk
Branch: master
Commit: 84ce8aa0967f5e20f062803691b86c3e3b060c60
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=84ce8aa0967f5e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 14 10:55:54 2018 +0200
6068 FIX Fixed misleading "Last user synchronization ran into an exception: User synchronization" message
When opening the Users page of the configuration an error message "Last user synchronization ran into an exception: User synchronization"
could be shown since 1.5.0b2. Even when no LDAP connection is configured. This error message has been fixed.
Change-Id: I3d6d5ba18239078404b3bf1bef88f13778ae024a
---
.werks/6068 | 12 ++++++++++++
web/htdocs/userdb.py | 1 +
2 files changed, 13 insertions(+)
diff --git a/.werks/6068 b/.werks/6068
new file mode 100644
index 0000000..56a245a
--- /dev/null
+++ b/.werks/6068
@@ -0,0 +1,12 @@
+Title: Fixed misleading "Last user synchronization ran into an exception: User synchronization" message
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1526288040
+
+When opening the Users page of the configuration an error message "Last user synchronization ran into an exception: User synchronization"
+could be shown since 1.5.0b2. Even when no LDAP connection is configured. This error message has been fixed.
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index edd4005..15de15c 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -1378,3 +1378,4 @@ class UserSyncBackgroundJob(gui_background_job.GUIBackgroundJob):
job_interface.send_progress_update(_("Finalizing synchronization"))
general_userdb_job()
+ return True