Nikolay Fedorov 56069be50b Change ironic-agent repository to opendev.org
Change-Id: Ibb7aef79673f5b53aede110ee15e7dcfb19c2164
2020-05-20 18:17:08 +04:00

51 lines
1.3 KiB
Bash

#!/usr/bin/env bash
set -xe
#Configure vars for rendering
pushd /ironic-vars
rm -f /shared/sed_commands
for var_name in $( ls ) ; do
echo -n s!\$\($var_name\)! >> /shared/sed_commands
cat $var_name >> /shared/sed_commands
echo ! >> /shared/sed_commands
export $var_name=$(cat $var_name)
done
popd
while ! ip -br addr show | grep -q "$PROVISIONING_IP/"; do
echo 'Waiting for provisioning ip'
sleep 5;
done
mkdir -p /shared/{tftpboot,ironic_prometheus_exporter,html/{images,pxelinux.cfg},log/{dnsmasq,httpd,ironic,ironic-inspector/ramdisk,mariadb}/}
# Remove log files from last deployment
rm -rf /shared/log/httpd/*
rm -rf /shared/log/ironic/*
rm -rf /shared/log/ironic-inspector/*
# Rendering files to shared mount
pushd /cfg
for f in $( ls ); do
sed -f /shared/sed_commands $f > /shared/$f
done
popd
pushd /shared/html/images
STATUSCODE=$(curl --silent --insecure --location -O --write-out "%{http_code}" ${IPA_RAMDISK})
if test $STATUSCODE -ne 200; then
echo "Failed to load ${ARTS[${art}]}"
exit 1
fi
STATUSCODE=$(curl --silent --insecure --location -O --write-out "%{http_code}" ${IPA_KERNEL})
if test $STATUSCODE -ne 200; then
echo "Failed to load ${ARTS[${art}]}"
exit 1
fi
popd
chmod -R 0777 /shared/html
touch /shared/init_finished