Browse code

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

Eric Windisch authored on 2014/03/01 14:24:51
Showing 1 changed files
... ...
@@ -104,8 +104,7 @@ function start_nova_hypervisor {
104 104
     fi
105 105
 
106 106
     # Make sure we copied the image in Glance
107
-    DOCKER_IMAGE=$(glance image-list | egrep " $DOCKER_IMAGE_NAME ")
108
-    if ! is_set DOCKER_IMAGE ; then
107
+    if ! (glance image-show "$DOCKER_IMAGE"); then
109 108
         docker push $DOCKER_REPOSITORY_NAME
110 109
     fi
111 110
 }