exit_handler() {
# Remove safety catch
- kill $killpid
+ kill -9 `ps -p $killpid -o pid --no-headers` \
+ `ps --ppid $killpid -o pid --no-headers`\
+ > /dev/null 2>&1
}
+# Set maximum allowed deploy time (default three hours)
+MAXDEPLOYTIME=${MAXDEPLOYTIME-3h}
+
####### MAIN ########
if [ "`whoami`" != "root" ]; then
fi
-# Enable safety catch at three hours
-(sleep 3h; kill $$) &
+# Enable safety catch
+echo "Enabling auto-kill if deployment exceeds $MAXDEPLOYTIME"
+(sleep $MAXDEPLOYTIME; echo "Auto-kill of deploy after a timeout of $MAXDEPLOYTIME"; kill $$) &
killpid=$!
# Enable exit handler
trap exit_handler exit
-
# Stop all VMs
for node in controller1 controller2 controller3 compute4 compute5 fuel-master
do
. ${functions}/install_iso.sh
. ${functions}/deploy_env.sh
-echo "Waiting for two minutes for deploy to stabilize"
-sleep 2m
+echo "Waiting for five minutes for deploy to stabilize"
+sleep 5m
echo "Verifying node status after deployment"
-set -o pipefail
# Any node with non-ready status?
-ssh root@10.20.0.2 fuel node | tail -n +3 | cut -d "|" -f 2 | \
+ssh root@10.20.0.2 fuel node 2>/dev/null | tail -n +3 | cut -d "|" -f 2 | \
sed 's/ //g' | grep -v ready | wc -l | grep -q "^0$"
if [ $? -ne 0 ]; then
- error_exit "Deployment failed verification"
+ echo "Deploy failed to verify"
+ ssh root@10.20.0.2 fuel node 2>/dev/null
+ error_exit "Exiting with error status"
else
+ ssh root@10.20.0.2 fuel node 2>/dev/null
echo "Deployment verified"
fi