Skip to content

Commit

Permalink
Merge pull request #541 from halfluke/fix537
Browse files Browse the repository at this point in the history
fix537
  • Loading branch information
konstruktoid authored Oct 23, 2023
2 parents 7287a35 + 8d97756 commit 4edccd7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion functions/helper_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ get_docker_configuration_file_args() {
if "$HAVE_JQ"; then
jq --monochrome-output --raw-output ".[\"${OPTION}\"]" "$CONFIG_FILE"
else
cat "$CONFIG_FILE" | tr { '\n' | tr , '\n' | tr } '\n' | grep "$OPTION" | sed 's/.*://g' | tr -d '" ',
cat "$CONFIG_FILE" | tr , '\n' | grep "$OPTION" | sed 's/.*://g' | tr -d '" ',
fi
}

Expand Down
17 changes: 6 additions & 11 deletions tests/2_docker_daemon_configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ check_2_2() {
logcheckresult "PASS"
return
fi
if get_docker_configuration_file_args 'icc' | grep "false" >/dev/null 2>&1; then
if [[ $(get_docker_configuration_file_args 'icc' | grep "false") ]] && [[ $(get_docker_configuration_file_args 'icc' | grep "false") != "null" ]] ; then
pass -s "$check"
logcheckresult "PASS"
return
Expand Down Expand Up @@ -93,7 +93,7 @@ check_2_4() {
logcheckresult "WARN"
return
fi
if get_docker_configuration_file_args 'iptables' | grep "false" >/dev/null 2>&1; then
if [[ $(get_docker_configuration_file_args 'iptables' | grep "false") ]] && [[ $(get_docker_configuration_file_args 'iptables' | grep "false") != "null" ]] ; then
warn -s "$check"
logcheckresult "WARN"
return
Expand All @@ -115,12 +115,7 @@ check_2_5() {
logcheckresult "WARN"
return
fi
if ! [ -z "$(get_docker_configuration_file_args 'insecure-registries')" ]; then
if get_docker_configuration_file_args 'insecure-registries' | grep '\[]' >/dev/null 2>&1; then
pass -s "$check"
logcheckresult "PASS"
return
fi
if [[ $(get_docker_configuration_file_args 'insecure-registries' | grep -v '\[]') ]] && [[ $(get_docker_configuration_file_args 'insecure-registries' | grep -v '\[]') != "null" ]] ; then
warn -s "$check"
logcheckresult "WARN"
return
Expand Down Expand Up @@ -187,7 +182,7 @@ check_2_8() {
local check="$id - $desc"
starttestjson "$id" "$desc"

if get_docker_configuration_file_args 'default-ulimit' | grep -v '{}' >/dev/null 2>&1; then
if [[ $(get_docker_configuration_file_args 'default-ulimits' | grep -v '{}') ]] && [[ $(get_docker_configuration_file_args 'default-ulimits' | grep -v '{}') != "null" ]] ; then
pass -c "$check"
logcheckresult "PASS"
return
Expand All @@ -210,7 +205,7 @@ check_2_9() {
local check="$id - $desc"
starttestjson "$id" "$desc"

if get_docker_configuration_file_args 'userns-remap' | grep -v '""'; then
if [[ $(get_docker_configuration_file_args 'userns-remap' | grep -v '""') ]] && [[ $(get_docker_configuration_file_args 'userns-remap' | grep -v '""') != "null" ]] ; then
pass -s "$check"
logcheckresult "PASS"
return
Expand Down Expand Up @@ -278,7 +273,7 @@ check_2_12() {
local check="$id - $desc"
starttestjson "$id" "$desc"

if get_docker_configuration_file_args 'authorization-plugins' | grep -v '\[]'; then
if [[ $(get_docker_configuration_file_args 'authorization-plugins' | grep -v '\[]') ]] && [[ $(get_docker_configuration_file_args 'authorization-plugins' | grep -v '\[]') != "null" ]] ; then
pass -s "$check"
logcheckresult "PASS"
return
Expand Down

0 comments on commit 4edccd7

Please sign in to comment.