]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat tools : glance-jeos-add-from-github scrape image names
authorSteven Hardy <shardy@redhat.com>
Mon, 20 Aug 2012 11:46:23 +0000 (12:46 +0100)
committerSteven Hardy <shardy@redhat.com>
Mon, 20 Aug 2012 12:02:35 +0000 (13:02 +0100)
Scrape image names from github index page to avoid hard-coded
names in the script

Change-Id: Ifca85b71a1c20d436486a80cc5e9347a7791e5fa
Signed-off-by: Steven Hardy <shardy@redhat.com>
tools/glance-jeos-add-from-github.sh

index 9c56ca1fa73d316d28bafc6b5c11b0f83338eeec..113c0a32f02a8ea504997049e0f4baebf4f68f7d 100755 (executable)
@@ -1,8 +1,15 @@
 #!/bin/bash
 # Downloads JEOS images from github and installs them in glance
 
-for i in F16-x86_64-cfntools F16-i386-cfntools F17-x86_64-cfntools F17-i386-cfntools F16-x86_64-cfntools-openshift U10-x86_64-cfntools
+DISK_FORMAT="qcow2"
+INDEX_URL="https://github.com/heat-api/prebuilt-jeos-images/downloads"
+DOWNLOAD_URL="http://cloud.github.com/downloads/heat-api/prebuilt-jeos-images"
+IMAGES=$(curl -s ${INDEX_URL} | grep 'href="/downloads/heat-api/prebuilt-jeos-images' 2>/dev/null | grep ${DISK_FORMAT} | cut -d">" -f2 | cut -d"<" -f1)
+
+for i in ${IMAGES}
 do
-   echo "Downloading and registering $i with OpenStack glance."
-glance add name=$i is_public=true disk_format=qcow2 container_format=bare copy_from="http://cloud.github.com/downloads/heat-api/prebuilt-jeos-images/$i.qcow2"
+    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"
 done