From: Steven Hardy Date: Mon, 20 Aug 2012 12:01:23 +0000 (+0100) Subject: heat tools : glance-jeos-add-from-github avoid duplicates X-Git-Tag: 2014.1~1526 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f48c114a4fa95a77f8bd00b399871d6c2e554b05;p=openstack-build%2Fheat-build.git heat tools : glance-jeos-add-from-github avoid duplicates Avoid adding images to glance when they already exist Change-Id: Ia914cc3015fcdcc0c12e3773985298fce6872751 Signed-off-by: Steven Hardy --- diff --git a/tools/glance-jeos-add-from-github.sh b/tools/glance-jeos-add-from-github.sh index 113c0a32..3a222335 100755 --- a/tools/glance-jeos-add-from-github.sh +++ b/tools/glance-jeos-add-from-github.sh @@ -10,6 +10,11 @@ for i in ${IMAGES} do NAME=$(echo $i | sed "s/\.${DISK_FORMAT}//") echo "Downloading and registering $i with OpenStack glance as ${NAME}" - echo "Downloading from ${DOWNLOAD_URL}/$i" - glance add name=${NAME} is_public=true disk_format=${DISK_FORMAT} container_format=bare copy_from="${DOWNLOAD_URL}/$i" + if glance index | grep -q "\s${NAME}\s" + then + echo "WARNING : ${NAME} already exists, skipping" + else + echo "Downloading from ${DOWNLOAD_URL}/$i" + glance add name=${NAME} is_public=true disk_format=${DISK_FORMAT} container_format=bare copy_from="${DOWNLOAD_URL}/$i" + fi done