diff --git a/inc_dockerfunctions.sh b/inc_dockerfunctions.sh index 86383e80cbb080b3bf44d45320a0b93d9c9f8fb9..3b94193e059c199ea158624d20abaa3aad22362c 100644 --- a/inc_dockerfunctions.sh +++ b/inc_dockerfunctions.sh @@ -28,14 +28,14 @@ _is_docker_detected=0 # param string json data # param string jq filter function _filterJson(){ - echo "$1" | jq "$2" + echo "$1" | jq -r "$2" } # filter json data with jq (by expecting a single result) and remove quotes # param string json data # param string jq filter function _getString(){ - _filterJson "$1" "$2" | tr -d '"' | sed "s#^null\$##" + _filterJson "$1" "$2" | sed "s#^null\$##g" } # if DOCKER_HOST is not set we try to detect the user running "containerd" @@ -74,12 +74,10 @@ function _detectDockererror(){ ph.exit fi - local sSrvErrror; - sSrvErrror=$( _filterJson "$data" ".ServerErrors" ) - if [ "$sSrvErrror" != "null" ] ; then + if grep '"ServerErrors"' <<<"$data" >/dev/null; then ph.setStatus unknown ph.status "Unable to connect to Docker:" - echo "$sSrvErrror" | grep "^ " + _filterJson "$data" ".ServerErrors" | grep "^ " ph.exit fi diff --git a/inc_pluginfunctions b/inc_pluginfunctions index 3f64983a8793b37c0a1f954a0b70b99706323170..55b1b19dafb370ce2931f14c2f491e0c614cf3da 100644 --- a/inc_pluginfunctions +++ b/inc_pluginfunctions @@ -299,9 +299,11 @@ function ph._getExp(){ # test "$_unit" = "m" && echo 10^-3 # test "$_unit" = "c" && echo 10^-2 # test "$_unit" = "d" && echo 10^-1 - # test "$_unit" = "k" && echo 10^3 - # test "$_unit" = "M" && echo 10^6 - # test "$_unit" = "G" && echo 10^9 + test "$_unit" = "k" && echo 10^3 + test "$_unit" = "Mi" && echo 10^6 + test "$_unit" = "Gi" && echo 10^9 + test "$_unit" = "Ti" && echo 10^9 + test "$_unit" = "Pi" && echo 10^9 # echo "ERROR: unsupported value: $_value" # exit 1