summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2017-02-13 09:16:29 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-02-13 09:16:29 +0000
commit9eae169018b1a04a50fc09e1d47e750876687cf6 (patch)
treebe59771b9d008aa097fe11074a93510f83dcd570
parent79b920c07b40d64e70f93f28a0822ad1488f32ee (diff)
parent81a982aa1dec85f0cb7ba8890de4df4c3043e1b1 (diff)
Merge "No action when no container is there"
-rwxr-xr-xjjb/functest/functest-cleanup.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/jjb/functest/functest-cleanup.sh b/jjb/functest/functest-cleanup.sh
index 3ef9b90dd..fc277b9ed 100755
--- a/jjb/functest/functest-cleanup.sh
+++ b/jjb/functest/functest-cleanup.sh
@@ -15,7 +15,10 @@ if [[ -n ${dangling_images} ]]; then
echo " Removing $FUNCTEST_IMAGE:<none> images and their containers..."
for image_id in "${dangling_images[@]}"; do
echo " Removing image_id: $image_id and its containers"
- docker ps -a | grep $image_id | awk '{print $1}'| xargs docker rm -f >${redirect}
+ containers=$(docker ps -a | grep $image_id | awk '{print $1}')
+ if [[ -n "$containers" ]];then
+ docker rm -f $containers >${redirect}
+ fi
docker rmi $image_id >${redirect}
done
fi