Module: check_mk
Branch: master
Commit: 29cc3db3a6caa9afcf0ca08f9359d3155e5c4c83
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=29cc3db3a6caa9…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Oct 24 14:50:55 2017 +0200
Fixed typo in werk
Change-Id: I675749c3746a21af18b8f7a2a31a807a84689faf
---
.werks/5192 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.werks/5192 b/.werks/5192
index 999c353..b73168c 100644
--- a/.werks/5192
+++ b/.werks/5192
@@ -11,7 +11,7 @@ Previously only 4 operators were available for filtering list-valued
columns:
<ul>
- <li<tt>=</tt>: checks that the list is empty</li>
+ <li><tt>=</tt>: checks that the list is empty</li>
<li><tt>!=</tt>: checks that the list is non-empty</li>
<li><tt><</tt>: checks that an element is not contained in the list using equality</li>
<li><tt>>=</tt>: checks that an element is contained in the list using equality</li>
Module: check_mk
Branch: master
Commit: e15de0b7a3818e2a7896d674f64f34872ad05868
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e15de0b7a3818e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 24 13:52:54 2017 +0200
The core is now only requesting EC columns from the EC, we can simplify things a bit
Change-Id: I184e59e7e3264ce4ee43e7d5df749f544d756ade
---
bin/mkeventd | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/bin/mkeventd b/bin/mkeventd
index 86cba42..4071499 100755
--- a/bin/mkeventd
+++ b/bin/mkeventd
@@ -3148,15 +3148,7 @@ class QueryGET(Query):
self.output_format = argument
elif header == "Columns":
- # TODO: The EC is handling unknown columns different than regular livestatus. The EC
- # silently ignores them and outputs only the known ones. We can only fix this in case
- # the core sends only the columns that the EC knows. At the moment it also requests
- # the host columns.
- #self.requested_columns = argument.split(" ")
- self.requested_columns = []
- for column_name in argument.split(" "):
- if column_name in self.table.column_defaults:
- self.requested_columns.append(column_name)
+ self.requested_columns = argument.split(" ")
elif header == "Filter":
name, opfunc, argument = self._parse_filter(argument)
Module: check_mk
Branch: master
Commit: 4993cf10ad4ff3f04bb29036da929ecc71ecffe0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4993cf10ad4ff3…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Oct 24 14:07:45 2017 +0200
5192 Added new filter operators for list-valued columns
Previously only 4 operators were available for filtering list-valued
columns:
<ul>
<li<tt>=</tt>: checks that the list is empty</li>
<li><tt>!=</tt>: checks that the list is non-empty</li>
<li><tt><</tt>: checks that an element is not contained in the list using equality</li>
<li><tt>>=</tt>: checks that an element is contained in the list using equality</li>
</ul>
6 new operators have been added:
<ul>
<li><tt><=</tt>: checks that an element is contained in the list using case-insensitive equality</li>
<li><tt>></tt>: checks that an element is not contained in the list using case-insensitive equality</li>
<li><tt>~</tt>: checks that an element is contained in the list using a substring regex match</li>
<li><tt>!~</tt>: checks that an element is not contained in the list using a substring regex match</li>
<li><tt>~~</tt>: checks that an element is contained in the list using a case-insensitive substring regex match</li>
<li><tt>!~~</tt>: checks that an element is not contained in the list using a case-insensitive substring regex match</li>
</ul>
Change-Id: I47288a1a87817c3ef66b5167a7aad602b184083d
---
.werks/5192 | 29 ++++++++++++++++
livestatus/src/ListFilter.cc | 81 ++++++++++++++++++++++++++++++++++----------
livestatus/src/ListFilter.h | 18 +++++++---
3 files changed, 106 insertions(+), 22 deletions(-)
diff --git a/.werks/5192 b/.werks/5192
new file mode 100644
index 0000000..999c353
--- /dev/null
+++ b/.werks/5192
@@ -0,0 +1,29 @@
+Title: Added new filter operators for list-valued columns
+Level: 1
+Component: livestatus
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1508845760
+Class: feature
+
+Previously only 4 operators were available for filtering list-valued
+columns:
+
+<ul>
+ <li<tt>=</tt>: checks that the list is empty</li>
+ <li><tt>!=</tt>: checks that the list is non-empty</li>
+ <li><tt><</tt>: checks that an element is not contained in the list using equality</li>
+ <li><tt>>=</tt>: checks that an element is contained in the list using equality</li>
+</ul>
+
+6 new operators have been added:
+
+<ul>
+ <li><tt><=</tt>: checks that an element is contained in the list using case-insensitive equality</li>
+ <li><tt>></tt>: checks that an element is not contained in the list using case-insensitive equality</li>
+ <li><tt>~</tt>: checks that an element is contained in the list using a substring regex match</li>
+ <li><tt>!~</tt>: checks that an element is not contained in the list using a substring regex match</li>
+ <li><tt>~~</tt>: checks that an element is contained in the list using a case-insensitive substring regex match</li>
+ <li><tt>!~~</tt>: checks that an element is not contained in the list using a case-insensitive substring regex match</li>
+</ul>
diff --git a/livestatus/src/ListFilter.cc b/livestatus/src/ListFilter.cc
index e0bd25d..aa58b71 100644
--- a/livestatus/src/ListFilter.cc
+++ b/livestatus/src/ListFilter.cc
@@ -24,41 +24,86 @@
#include "ListFilter.h"
#include <algorithm>
-#include <ostream>
-#include <vector>
+#include <cstring>
+#include <sstream>
+#include <string>
#include "ListColumn.h"
#include "Logger.h"
#include "Row.h"
ListFilter::ListFilter(const ListColumn &column, RelationalOperator relOp,
- std::string element)
- : _column(column), _relOp(relOp), _element(std::move(element)) {}
+ std::string value)
+ : _column(column), _relOp(relOp), _ref_string(std::move(value)) {
+ switch (_relOp) {
+ case RelationalOperator::matches:
+ case RelationalOperator::doesnt_match:
+ case RelationalOperator::matches_icase:
+ case RelationalOperator::doesnt_match_icase:
+ _regex.assign(_ref_string,
+ (_relOp == RelationalOperator::matches_icase ||
+ _relOp == RelationalOperator::doesnt_match_icase)
+ ? std::regex::extended | std::regex::icase
+ : std::regex::extended);
+ break;
+ case RelationalOperator::equal:
+ case RelationalOperator::not_equal:
+ case RelationalOperator::equal_icase:
+ case RelationalOperator::not_equal_icase:
+ case RelationalOperator::less:
+ case RelationalOperator::greater_or_equal:
+ case RelationalOperator::greater:
+ case RelationalOperator::less_or_equal:
+ break;
+ }
+}
bool ListFilter::accepts(Row row, const contact *auth_user,
std::chrono::seconds /* timezone_offset */) const {
switch (_relOp) {
case RelationalOperator::equal:
+ if (!_ref_string.empty()) {
+ Informational(_column.logger())
+ << "Sorry, equality for lists implemented only for emptiness";
+ return false;
+ }
+ return !any(row, auth_user,
+ [](const std::string &) { return true; });
case RelationalOperator::not_equal:
- if (!_element.empty()) {
+ if (!_ref_string.empty()) {
Informational(_column.logger())
- << "Sorry, equality for lists implemented only for emptyness";
+ << "Sorry, inequality for lists implemented only for emptiness";
+ return false;
}
- return _column.getValue(row, auth_user).empty() ==
- (_relOp == RelationalOperator::equal);
- case RelationalOperator::less:
- case RelationalOperator::greater_or_equal: {
- auto val = _column.getValue(row, auth_user);
- return (std::find(val.begin(), val.end(), _element) == val.end()) ==
- (_relOp == RelationalOperator::less);
- }
+ return any(row, auth_user,
+ [](const std::string &) { return true; });
case RelationalOperator::matches:
- case RelationalOperator::doesnt_match:
- case RelationalOperator::equal_icase:
- case RelationalOperator::not_equal_icase:
case RelationalOperator::matches_icase:
+ return any(row, auth_user, [&](const std::string &elem) {
+ return regex_search(elem, _regex);
+ });
+ case RelationalOperator::doesnt_match:
case RelationalOperator::doesnt_match_icase:
+ return !any(row, auth_user, [&](const std::string &elem) {
+ return regex_search(elem, _regex);
+ });
+ case RelationalOperator::less:
+ return !any(row, auth_user, [&](const std::string &elem) {
+ return _ref_string == elem;
+ });
+ case RelationalOperator::greater_or_equal:
+ return any(row, auth_user, [&](const std::string &elem) {
+ return _ref_string == elem;
+ });
case RelationalOperator::greater:
+ return !any(row, auth_user, [&](const std::string &elem) {
+ return strcasecmp(_ref_string.c_str(), elem.c_str()) == 0;
+ });
case RelationalOperator::less_or_equal:
+ return any(row, auth_user, [&](const std::string &elem) {
+ return strcasecmp(_ref_string.c_str(), elem.c_str()) == 0;
+ });
+ case RelationalOperator::equal_icase:
+ case RelationalOperator::not_equal_icase:
Informational(_column.logger())
<< "Sorry. Operator " << _relOp
<< " for list columns not implemented.";
@@ -71,7 +116,7 @@ const std::string *ListFilter::valueForIndexing(
const std::string &column_name) const {
switch (_relOp) {
case RelationalOperator::greater_or_equal:
- return column_name == columnName() ? &_element : nullptr;
+ return column_name == columnName() ? &_ref_string : nullptr;
case RelationalOperator::equal:
case RelationalOperator::not_equal:
case RelationalOperator::matches:
diff --git a/livestatus/src/ListFilter.h b/livestatus/src/ListFilter.h
index 0de2b2b..6fde087 100644
--- a/livestatus/src/ListFilter.h
+++ b/livestatus/src/ListFilter.h
@@ -26,18 +26,21 @@
#define ListFilter_h
#include "config.h" // IWYU pragma: keep
+#include <algorithm>
#include <chrono>
+#include <regex>
#include <string>
+#include <vector>
#include "ColumnFilter.h"
+#include "ListColumn.h"
+#include "Row.h"
#include "contact_fwd.h"
#include "opids.h"
-class ListColumn;
-class Row;
class ListFilter : public ColumnFilter {
public:
ListFilter(const ListColumn &column, RelationalOperator relOp,
- std::string element);
+ std::string value);
bool accepts(Row row, const contact *auth_user,
std::chrono::seconds timezone_offset) const override;
const std::string *valueForIndexing(
@@ -47,7 +50,14 @@ public:
private:
const ListColumn &_column;
const RelationalOperator _relOp;
- const std::string _element;
+ const std::string _ref_string;
+ std::regex _regex;
+
+ template <typename UnaryPredicate>
+ bool any(Row row, const contact *auth_user, UnaryPredicate pred) const {
+ auto val = _column.getValue(row, auth_user);
+ return std::any_of(val.begin(), val.end(), pred);
+ }
};
#endif // ListFilter_h
Module: check_mk
Branch: master
Commit: d50b77d7d6eef85cb209bdc1b232c5d1e6764f82
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d50b77d7d6eef8…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Tue Oct 24 13:57:14 2017 +0200
Even more detailed description of werk 5305
Change-Id: Ia08caad06451d1ae969cb6672732afe498b388bd
---
.werks/5305 | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/.werks/5305 b/.werks/5305
index 1ea6dc6..058aca9 100644
--- a/.werks/5305
+++ b/.werks/5305
@@ -1,4 +1,4 @@
-Title: check_mk_agent.hpux: Fix hardcoded version in lib path
+Title: check_mk_agent.hpux: Fixed path for Plugins and local checks
Level: 1
Component: checks
Compatible: incomp
@@ -8,8 +8,16 @@ Date: 1508765713
Class: fix
The original path for lib files has been hardcoded to omd version 0.45. The
-path now uses the regular path which is standard for linux and solaris.
+scripts are now executed from the expected location which is standard for
+linux and solaris. This results in a changed path for local and regular
+plugins for the agent.
-If the agent will be replaced by this new version, the lib path has to be changed also:
-Old: /omd/versions/0.45.20110123/lib/check_mk_agent
-New: /usr/lib/check_mk_agent
+If the agent will be replaced by this new version, the new paths are:
+
+local checks:
+Old: /omd/versions/0.45.20110123/lib/check_mk_agent/local
+New: /usr/lib/check_mk_agent/local
+
+plugins:
+OLD: /omd/versions/0.45.20110123/lib/check_mk_agent/plugins
+New: /usr/lib/check_mk_agent/plugins
Module: check_mk
Branch: master
Commit: 2240d8c420439350311025f563859215856c8b7b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2240d8c4204393…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 24 13:23:21 2017 +0200
Check/create the build user not only during chroot setup
Change-Id: I0f8062b2587ea35494af5950928695b24e2dafdc
---
agents/windows/make-agent | 9 +++++++++
agents/windows/make-chroot | 6 ------
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/agents/windows/make-agent b/agents/windows/make-agent
index 1623201..c664283 100755
--- a/agents/windows/make-agent
+++ b/agents/windows/make-agent
@@ -63,6 +63,15 @@ fi
VERSIONFILE=$versionfile CHROOT_PATH=$CHROOT_PATH \
CHROOT_BUILD_DIR=$CHROOT_BUILD_DIR ./make-chroot
fi
+
+ # Add user for building windows agent without root privileges.
+ # Check that user does not exist before since SUDO_USER may be root, as well.
+ #
+ # Do this not only during setup, because the setup is only executed once and
+ # the build may be started with different SUDO_USER users).
+ if ! grep -q "\<${SUDO_USER}\>" "$CHROOT_PATH/etc/passwd" ; then
+ ./do-chroot "useradd -lmo -u $(id -u $SUDO_USER) -s /bin/bash $SUDO_USER"
+ fi
) 200>/var/lock/cmk-make-agent_${CHROOT_PATH//\//-}.lock
echo "[MAKE-CHROOT LOCK] released"
diff --git a/agents/windows/make-chroot b/agents/windows/make-chroot
index df319a9..288080a 100755
--- a/agents/windows/make-chroot
+++ b/agents/windows/make-chroot
@@ -148,12 +148,6 @@ if [ ! -h $CHROOT_PATH/usr/bin/python ] ; then
ln -sf python2.7 $CHROOT_PATH/usr/bin/python
fi
-# Add user for building windows agent without root privileges.
-# Check that user does not exist before since SUDO_USER may be root, as well.
-if ! grep -q "\<${SUDO_USER}\>" "$CHROOT_PATH/etc/passwd" ; then
- ./do-chroot "useradd -lmo -u $(id -u $SUDO_USER) -s /bin/bash $SUDO_USER"
-fi
-
# "Disable" apt privilege dropping in chroot
sed -ri 's/^_apt:x:[0-9]+:/_apt:x:0:/g' $CHROOT_PATH/etc/passwd
Module: check_mk
Branch: master
Commit: 7deca0cfab8cf16f080c267e9ba61403d242870c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7deca0cfab8cf1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 24 12:56:53 2017 +0200
Updated bug entries #3011
Change-Id: Id3abcd2d5761be7337dded530cf81a125f8022ab
---
.bugs/3011 | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/.bugs/3011 b/.bugs/3011
new file mode 100644
index 0000000..158e475
--- /dev/null
+++ b/.bugs/3011
@@ -0,0 +1,9 @@
+Title: View painters: Fix escaping of painter content
+Component: multisite
+State: open
+Date: 2017-10-24 12:55:34
+Targetversion: 1.5.0
+Class: bug
+
+This is similar to gitbug #2981. The default for the paint functions hast to be that non HTML()
+returned objects (string, unicode, ...) need to be escaped when rendering to the view.
Module: check_mk
Branch: master
Commit: 71ffc7ec41affcc0315792a4363c091a696c4e5d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=71ffc7ec41affc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 24 11:08:45 2017 +0200
make-agent: Lock chroot setup / up-to-date check for build environment
Change-Id: Ia49f8fcb67fa632cd85fba56af00daed7306c5e4
---
agents/windows/make-agent | 47 +++++++++++++++++++++++++++++------------------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/agents/windows/make-agent b/agents/windows/make-agent
index 619f0c3..1623201 100755
--- a/agents/windows/make-agent
+++ b/agents/windows/make-agent
@@ -35,25 +35,36 @@ if [ ! -f "$base/agents/windows/$versionfile" ] ; then
exit 1
fi
-# Ensure that chroot exists and is up to date:
-# ensure that versionfile exists...
-if [ ! -f "$CHROOT_PATH/$versionfile" ] ; then
- echo "chroot version not found."
- create=yes
- # ... and it is up to date.
-elif [ $(cat "$CHROOT_PATH/$versionfile") -ne \
- $(cat "$base/agents/windows/$versionfile") ] ; then
- echo "chroot is out of date."
- create=yes
-fi
+# Realize a file based locking for the chroot setup. There must be only
+# a single caller executing the setup of a chroot. Once the chroot was
+# created, multiple jobs may be executed in the chroot simultaneously,
+# but the setup must be performed only by a single job.
+(
+ echo "[MAKE-CHROOT LOCK] aquire"
+ flock -x -w 1800 200 || (echo "[MAKE-CHROOT LOCK] ERROR: Failed to get lock within 1800 seconds" ; exit 1)
+ echo "[MAKE-CHROOT LOCK] got it"
-if [ -z $create ] ; then
- echo "chroot is up to date."
-else
- apt-get -y install "${chroot_dependencies[@]}"
- VERSIONFILE=$versionfile CHROOT_PATH=$CHROOT_PATH \
- CHROOT_BUILD_DIR=$CHROOT_BUILD_DIR ./make-chroot
-fi
+ # Ensure that chroot exists and is up to date:
+ # ensure that versionfile exists...
+ if [ ! -f "$CHROOT_PATH/$versionfile" ] ; then
+ echo "chroot version not found."
+ create=yes
+ # ... and it is up to date.
+ elif [ $(cat "$CHROOT_PATH/$versionfile") -ne \
+ $(cat "$base/agents/windows/$versionfile") ] ; then
+ echo "chroot is out of date."
+ create=yes
+ fi
+
+ if [ -z $create ] ; then
+ echo "chroot is up to date."
+ else
+ apt-get -y install "${chroot_dependencies[@]}"
+ VERSIONFILE=$versionfile CHROOT_PATH=$CHROOT_PATH \
+ CHROOT_BUILD_DIR=$CHROOT_BUILD_DIR ./make-chroot
+ fi
+) 200>/var/lock/cmk-make-agent_${CHROOT_PATH//\//-}.lock
+echo "[MAKE-CHROOT LOCK] released"
# Build the Windows agent within chroot by calling the 'build-agent' script as
# $SUDO_USER.