Make ipa-downloader error fail the build
[icn.git] / deploy / metal3-vm / 02_configure_host.sh
index e2d3c77..634d4ee 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-set -xe
+set -eux -o pipefail
 
 # shellcheck disable=SC1091
 source lib/logging.sh
@@ -145,7 +145,7 @@ if [[ "$MANAGE_BR_BRIDGE" == "y" && $OS == "centos" ]] ; then
   fi
 fi
 
-for name in ironic ironic-inspector dnsmasq httpd mariadb ipa-downloader; do                  
+for name in ironic ironic-inspector dnsmasq httpd mariadb ipa-downloader; do
     sudo "${CONTAINER_RUNTIME}" ps | grep -w "$name$" && sudo "${CONTAINER_RUNTIME}" kill $name
     sudo "${CONTAINER_RUNTIME}" ps --all | grep -w "$name$" && sudo "${CONTAINER_RUNTIME}" rm $name -f
 done
@@ -181,15 +181,16 @@ else
   POD_NAME=""
 fi
 
-cat <<EOF > ${PWD}/ironic.env                                                 
-PROVISIONING_INTERFACE=provisioning                                               
-DHCP_RANGE=172.22.0.10,172.22.0.100                                               
-DEPLOY_KERNEL_URL=http://172.22.0.1/images/ironic-python-agent.kernel             
-DEPLOY_RAMDISK_URL=http://172.22.0.1/images/ironic-python-agent.initramfs         
-IRONIC_ENDPOINT=http://172.22.0.1:6385/v1/                                        
-IRONIC_INSPECTOR_ENDPOINT=http://172.22.0.1:5050/v1/                              
-CACHEURL=http://172.22.0.1/images                                                 
-IRONIC_FAST_TRACK=false                                                           
+cat <<EOF > ${PWD}/ironic.env
+PROVISIONING_INTERFACE=provisioning
+DHCP_RANGE=172.22.0.10,172.22.0.100
+IPA_BASEURI=https://images.rdoproject.org/train/rdo_trunk/current-tripleo
+DEPLOY_KERNEL_URL=http://172.22.0.1/images/ironic-python-agent.kernel
+DEPLOY_RAMDISK_URL=http://172.22.0.1/images/ironic-python-agent.initramfs
+IRONIC_ENDPOINT=http://172.22.0.1:6385/v1/
+IRONIC_INSPECTOR_ENDPOINT=http://172.22.0.1:5050/v1/
+CACHEURL=http://172.22.0.1/images
+IRONIC_FAST_TRACK=false
 EOF
 
 # Start image downloader container
@@ -199,6 +200,12 @@ sudo "${CONTAINER_RUNTIME}" run -d --net host --privileged --name ipa-downloader
 
 sudo "${CONTAINER_RUNTIME}" wait ipa-downloader
 
+if [ ! -e "$IRONIC_DATA_DIR/html/images/ironic-python-agent.kernel" ] ||
+   [ ! -e "$IRONIC_DATA_DIR/html/images/ironic-python-agent.initramfs" ]; then
+    echo "Failed to get ironic-python-agent"
+    exit 1
+fi
+
 # Start dnsmasq, http, mariadb, and ironic containers using same image
 # See this file for env vars you can set, like IP, DHCP_RANGE, INTERFACE
 sudo "${CONTAINER_RUNTIME}" run -d --net host --privileged --name dnsmasq \