From 4bb6e19965d5a148c1d11dbe0544d28323225ec4 Mon Sep 17 00:00:00 2001 From: jammasterj89 Date: Mon, 29 Jul 2019 16:15:57 +0100 Subject: [PATCH] Added check_images Added check_images which moves the previous $imgList into this function and removed the else as this is handled within the main .sh Signed-off-by: Niall T --- tests/4_container_images.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/4_container_images.sh b/tests/4_container_images.sh index 0df2676..954512d 100644 --- a/tests/4_container_images.sh +++ b/tests/4_container_images.sh @@ -1,19 +1,21 @@ #!/bin/sh +check_images() { if [ -n "$imgList" ]; then pattern=$(echo "$imgList" | sed 's/,/ /g') for img in $pattern; do echo "Looking for image $img" - sha256=$(docker image ls "$img" -q) + sha256=$(docker images | grep $img | awk '{print $3}') if [ -z "$sha256" ]; then echo "Image $img not found. Exiting." exit 1 fi - images="$images $sha256 " - done -else - images=$(docker images -q) + images="$sha256" + echo "images ------------------------------------ " $images + echo "sha356" $sha256 + done fi +} check_4() { logit "\n"