Use glance image-show to check for uploaded Docker images

The behavior of the code being replaced was failing
with '-o errexit' should that, as in the common case,
the image has not been uploaded into Glance.

While we could workaround this using a '|| :', the existing
code also happened to overwrite the DOCKER_IMAGE global
which is used elsewhere. It seemed prudent to either change
this variable name or remove it altogether.

Finally, using 'glance image-show' is more deterministic
than grepping the output of 'glance image-list'.

Change-Id: I23188155966ae9db64259b4a9d25a0d98c63c912
Closes-Bug: 1286443
This commit is contained in:
Eric Windisch 2014-03-01 00:24:51 -05:00
parent 9f2ee82d2c
commit a8880cc22c

View File

@ -104,8 +104,7 @@ function start_nova_hypervisor {
fi
# Make sure we copied the image in Glance
DOCKER_IMAGE=$(glance image-list | egrep " $DOCKER_IMAGE_NAME ")
if ! is_set DOCKER_IMAGE ; then
if ! (glance image-show "$DOCKER_IMAGE"); then
docker push $DOCKER_REPOSITORY_NAME
fi
}