Skip to content
Snippets Groups Projects
Commit dbf53866 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

added debug infos

parent 6404bee9
Branches
No related tags found
1 merge request!233Docker checks: remove emoji icons; handle "null" in license info; show rootless or not
......@@ -17,6 +17,9 @@
. $(dirname $0)/inc_pluginfunctions
_is_docker_rootless=0
_is_docker_detected=0
# ----------------------------------------------------------------------
# FUNCTIONS
# ----------------------------------------------------------------------
......@@ -32,19 +35,33 @@ function _filterJson(){
# param string json data
# param string jq filter
function _getString(){
_filterJson "$1" "$2" | tr -d '"'
_filterJson "$1" "$2" | tr -d '"' | sed "s#^null\$##"
}
# if DOCKER_HOST is not set we try to detect the user running "containerd"
# create an env var DOCKER_HOST="unix:///run/user/<ID>/docker.sock"
function _detectDockerenv(){
local dockeruid=
if [ -z "$DOCKER_HOST" ]; then
_is_docker_detected=1
dockeruid=$( ps -ef | grep containerd | grep -Eo "/run/user/([0-9]*)/" | head -1 | cut -f 4 -d '/' )
test -n "$dockeruid" && export DOCKER_HOST="unix:///run/user/$dockeruid/docker.sock"
# Don't abort - it is allowed that the variable DOCKER_HOST is missing
fi
if grep "/run/user/[0-9]*" <<< "$DOCKER_HOST" >/dev/null; then
_is_docker_rootless=1
fi
}
# show some debug infos to be shown if needed.
function _debugInfos(){
echo
echo "DEBUG INFOS:"
echo "DOCKER_HOST = $DOCKER_HOST"
test "$_is_docker_detected" -eq 0 && echo "It was set in the environment."
test "$_is_docker_detected" -eq 1 && echo "It was detected from process list."
echo
}
# detect error after dicker command. It stops if
# - no content was fetched
# - content contains key "ServerErrors"
......@@ -57,6 +74,7 @@ function _detectDockererror(){
ph.exit
fi
local sSrvErrror;
sSrvErrror=$( _filterJson "$data" ".ServerErrors" )
if [ "$sSrvErrror" != "null" ] ; then
ph.setStatus unknown
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment