Prevent build crashes on empty cache 23/6623/3
authorMichael Chapman <woppin@gmail.com>
Thu, 14 Jan 2016 04:03:37 +0000 (15:03 +1100)
committerMichael Chapman <woppin@gmail.com>
Mon, 15 Feb 2016 13:42:04 +0000 (00:42 +1100)
When there is no file to run md5sum on, instack will bail instead
of downloading a fresh copy. Check for file existence first, and if
it fails then immediately download required file.

Also don't try to install epel if it's already there.

Change-Id: I2248a916207b0bf9368d74d19c4087da846ed3d9

build/instack.sh

index 91c0d35..3f7d681 100755 (executable)
@@ -198,7 +198,7 @@ IMAGES+=" undercloud.qcow2"
 
 for i in $IMAGES; do
   # download prebuilt images from RDO Project
-  if [ "$(curl -L $rdo_images_uri/${i}.md5 | awk {'print $1'})" != "$(md5sum stack/$i | awk {'print $1'})" ] ; then
+  if [ ! -f stack/$i ] || [ "$(curl -L $rdo_images_uri/${i}.md5 | awk {'print $1'})" != "$(md5sum stack/$i | awk {'print $1'})" ] ; then
     #if [ $i == "undercloud.qcow2" ]; then
     ### there's a problem with the Content-Length reported by the centos artifacts
     ### server so using wget for it until a resolution is figured out.
@@ -260,7 +260,7 @@ LIBGUESTFS_BACKEND=direct virt-customize \
     --run-command "cd /etc/puppet/modules/ && rm -rf aodh && tar xzf puppet-aodh.tar.gz" \
     --run-command "yum remove -y openstack-neutron-openvswitch" \
     --run-command "echo 'nf_conntrack_proto_sctp' > /etc/modules-load.d/nf_conntrack_proto_sctp.conf" \
-    --install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
+    --run-command "if ! rpm -q epel-release > /dev/null; then yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm; fi" \
     --install "$AODH_PKG,ceph" \
     -a overcloud-full-opendaylight.qcow2