From 7fc5dc33a737ecbd4d77e8cd95607ecfb24dcf40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Fri, 27 Jan 2017 10:59:57 +0100 Subject: [PATCH 1/3] sh if lint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- tests/5_container_runtime.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/5_container_runtime.sh b/tests/5_container_runtime.sh index 66f6b4f..2c96aad 100644 --- a/tests/5_container_runtime.sh +++ b/tests/5_container_runtime.sh @@ -240,9 +240,7 @@ else fail=0 for c in $containers; do - docker inspect --format '{{ .Config.Memory }}' "$c" 2> /dev/null 1>&2 - - if [ "$?" -eq 0 ]; then + if docker inspect --format '{{ .Config.Memory }}' "$c" 2> /dev/null 1>&2; then memory=$(docker inspect --format '{{ .Config.Memory }}' "$c") else memory=$(docker inspect --format '{{ .HostConfig.Memory }}' "$c") @@ -269,9 +267,7 @@ else fail=0 for c in $containers; do - docker inspect --format '{{ .Config.CpuShares }}' "$c" 2> /dev/null 1>&2 - - if [ "$?" -eq 0 ]; then + if docker inspect --format '{{ .Config.CpuShares }}' "$c" 2> /dev/null 1>&2; then shares=$(docker inspect --format '{{ .Config.CpuShares }}' "$c") else shares=$(docker inspect --format '{{ .HostConfig.CpuShares }}' "$c") From 6c358427342ff4657b6b33e877bf60d066b33d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Fri, 27 Jan 2017 11:00:25 +0100 Subject: [PATCH 2/3] 5.19 check correction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- tests/5_container_runtime.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/5_container_runtime.sh b/tests/5_container_runtime.sh index 2c96aad..60e4fd4 100644 --- a/tests/5_container_runtime.sh +++ b/tests/5_container_runtime.sh @@ -455,9 +455,8 @@ else fail=0 for c in $containers; do - mode=$(docker inspect --format 'Propagation={{range $mnt := .Mounts}} {{json $mnt.Propagation}} {{end}}' "$c") - - if [ "$mode" = "Propagation=shared" ]; then + if docker inspect --format 'Propagation={{range $mnt := .Mounts}} {{json $mnt.Propagation}} {{end}}' "$c" | \ + grep shared 2>/dev/null 1>&2; then # If it's the first container, fail the test if [ $fail -eq 0 ]; then warn "$check_5_19" From 4e126efdbbc8ca11642b997b4a322a77796ffb0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Fri, 27 Jan 2017 11:00:36 +0100 Subject: [PATCH 3/3] 5.25 check correction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- tests/5_container_runtime.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/5_container_runtime.sh b/tests/5_container_runtime.sh index 60e4fd4..7c6ff7a 100644 --- a/tests/5_container_runtime.sh +++ b/tests/5_container_runtime.sh @@ -552,9 +552,7 @@ else fail=0 for c in $containers; do - docker inspect --format 'SecurityOpt={{.HostConfig.SecurityOpt }}' "$c" | grep 'no-new-privileges' 2>/dev/null 1>&2 - - if [ $? -ne 0 ]; then + if ! docker inspect --format 'SecurityOpt={{.HostConfig.SecurityOpt }}' "$c" | grep 'no-new-privileges' 2>/dev/null 1>&2; then # If it's the first container, fail the test if [ $fail -eq 0 ]; then warn "$check_5_25"