From a8880cc22c540e88c43da4e49fa6c976361484e4 Mon Sep 17 00:00:00 2001 From: Eric Windisch Date: Sat, 1 Mar 2014 00:24:51 -0500 Subject: [PATCH] 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 --- lib/nova_plugins/hypervisor-docker | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/nova_plugins/hypervisor-docker b/lib/nova_plugins/hypervisor-docker index f8dc6afa19..cdbc4d172d 100644 --- a/lib/nova_plugins/hypervisor-docker +++ b/lib/nova_plugins/hypervisor-docker @@ -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 }