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
(Cherry-picked from commit fe83d703aa)
This commit is contained in:
Jianghua Wang 2016-10-14 11:03:30 +08:00 committed by Bob Ball
parent c1630cc966
commit 0c700b43f8
1 changed files with 1 additions and 1 deletions

View File

@ -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