Enabling alternalte method to get remote md5 43/23743/2
authorDan Radez <dradez@redhat.com>
Fri, 28 Oct 2016 07:59:43 +0000 (03:59 -0400)
committerDan Radez <dradez@redhat.com>
Tue, 1 Nov 2016 15:06:15 +0000 (11:06 -0400)
The onos tar is an example of the remote server not supplying
a .md5 file with the md5 in it. It is instead posted on an html
page that can be scraped to get the value. This patch adds the ability
to pass that value into the caching functions so can keep onos
cached and not redownload it over and over again

JIRA: APEX-325

Change-Id: I88be72d4fd6aa7245b02b9ef0f2b7e6eefff3dac
Signed-off-by: Dan Radez <dradez@redhat.com>
build/cache.sh
build/overcloud-onos.sh

index 4d41a7a..5c7e5e7 100644 (file)
@@ -38,12 +38,15 @@ function curl_file {
 }
 
 # $1 =  download url
+# $2 =  remote md5
 function populate_cache {
     local my_md5
     cache_dir
 
     # get the file name
     filename="${1##*/}"
+    # copy passed in md5
+    remote_md5=$2
 
     # check if the cache file exists
     # and if it has an md5 compare that
@@ -53,7 +56,9 @@ function populate_cache {
         curl_file $1 $filename
     else
         echo "Cache file exists...comparing MD5 checksum"
-        remote_md5="$(curl -sf -L ${1}.md5 | awk {'print $1'})"
+        if [ -z $remote_md5 ]; then
+            remote_md5="$(curl -sf -L ${1}.md5 | awk {'print $1'})"
+        fi
         if [ -z "$remote_md5" ]; then
             echo "Got empty MD5 from remote for $filename, skipping MD5 check"
             curl_file $1 $filename
index 2b3e522..921ad50 100755 (executable)
@@ -20,7 +20,7 @@ cp -f overcloud-full.qcow2 overcloud-full-onos_build.qcow2
 
 # get the onos files
 rm -rf puppet-onos
-populate_cache "$onos_release_uri/$onos_release_file"
+populate_cache "$onos_release_uri/$onos_release_file" "$(curl https://downloads.onosproject.org/nightly/ | grep $onos_release_file | grep -o -e '[0-9a-f]\{32\}')"
 populate_cache "$onos_jdk_uri/jdk-8u51-linux-x64.tar.gz"
 
 LIBGUESTFS_BACKEND=direct virt-customize --upload $CACHE_DIR/$onos_release_file:/opt/ \