From fe83d703aabd6255003e74d8fbe468814df39a77 Mon Sep 17 00:00:00 2001 From: Jianghua Wang Date: Fri, 14 Oct 2016 11:03:30 +0800 Subject: [PATCH] Avoid except exit due to no TestVM image The controller_post_deployment.sh is run with "-e" which means it will exit directly if any error occured. The command of "grep" will return non-zero if it find no line with the pattern. So this script will exit unexpectedly if there is no TestVM image exists. Change-Id: Ie5ca9e89e1687787a5173e2ea8cedffd8eb9bfdd --- plugin_source/deployment_scripts/controller_post_deployment.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin_source/deployment_scripts/controller_post_deployment.sh b/plugin_source/deployment_scripts/controller_post_deployment.sh index 257ad34..926ade8 100755 --- a/plugin_source/deployment_scripts/controller_post_deployment.sh +++ b/plugin_source/deployment_scripts/controller_post_deployment.sh @@ -14,7 +14,7 @@ function replace_test_image { local image_file image_file="$3" - image_id=$(glance image-list | grep "$image_name" | awk -F "|" '{print $2}' | grep -v '^$') + image_id=$(glance image-list | awk -F "|" '/'$image_name'/ {print $2}') if [[ -n "$image_id" ]]; then echo "Delete image $image_name" >> $LOG_FILE