Module: check_mk
Branch: master
Commit: 43a91603fe44c293a70caf9685843815465cfcdb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43a91603fe44c2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 28 08:15:21 2018 +0200
6180 FIX docker: Try to execute agent only in containers having the bash
Change-Id: I8d579a6dc5831780ca41598af537c0254ec068c7
---
.werks/6180 | 11 +++++++++++
agents/check_mk_agent.linux | 8 ++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/.werks/6180 b/.werks/6180
new file mode 100644
index 0000000..0bc6c78
--- /dev/null
+++ b/.werks/6180
@@ -0,0 +1,11 @@
+Title: docker: Try to execute agent only in containers having the bash
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1527445495
+
+
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 85c7d4c..4347424 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -1047,12 +1047,8 @@ if type docker > /dev/null 2>&1 ; then
AGENT_PATH=$(docker container exec "$CONTAINER_ID" which check_mk_agent
2>/dev/null)
if [ -n "$AGENT_PATH" ]; then
docker container exec --env "REMOTE=$REMOTE"
"$CONTAINER_ID" check_mk_agent
- else
- # TODO: In case the docker part is added to the official agent script
- # erase the hard coded path and replace it with 'basename
"$0"'.
- # In case the docker stuff remains as plugin, at least replace it with
- # to get the agent path $(type check_mk_agent).
- docker container exec --env "MK_FROM_NODE=1,REMOTE=$REMOTE" -i
"$CONTAINER_ID" bash </usr/bin/check_mk_agent
+ elif docker container exec "$CONTAINER_ID" which bash >/dev/null
2>&1; then
+ docker container exec --env "MK_FROM_NODE=1,REMOTE=$REMOTE" -i
"$CONTAINER_ID" bash < "$0"
fi
echo "<<<<>>>>"