airshipctl/tools/airship-in-a-pod/base/wait_for
Fletcher, Stacey (sf5715) a423607000 Airship in a Pod
Introduces Airship in pod. This includes:
* A base image which sets up common requirements
* An image for the libvirt service
* An image for building a specified instance of airshipctl
* An image for initializing the various libvirt infrastructure required
  for a deployment
* An image which runs the deployment scripts

Closes: #313

Change-Id: Ib1114350190b0fe0c0761ff67b38b3eca783161a
2021-02-22 19:55:44 -06:00

23 lines
590 B
Bash
Executable File

#!/bin/bash
# wait_for takes a list of container names and runs until all of those container names
# appear in the "/tmp/completed" directory. It can be used to prevent a
# container from executing until pre-requisite containers have indicated completion.
mkdir -p "/tmp/completed"
while true; do
# Assume we're finished, prove otherwise
finished=true
for container in "$@"; do
if [[ ! -e "/tmp/completed/$container" ]]; then
printf "Waiting on '%s'...\n" "$container"
finished=false
sleep 10
break
fi
done
if $finished; then
break
fi
done