Only wait for checksum processes

When running under nodepool in a foreground, non-daemonized situation
without a tty (i.e. within a container) we're seeing this "wait" hang
indefinitely.

It is probably related to "outfilter.py" and output file descriptors,
although TBH we haven't completely root-caused it.  I won't claim this
is a great solution, but it should hopefully let the dib process
finish and just die, where outfilter will disappear.

Change-Id: If78da54df3d4c240fee16aee4413ec554b37c1d6
This commit is contained in:
Ian Wienand 2019-11-21 12:35:04 +11:00
parent 3636b40f74
commit bee30b43d2

View File

@ -66,9 +66,17 @@ function finish_image () {
mv $OUT_IMAGE_PATH $1
if [ "$DIB_CHECKSUM" == "1" ]; then
# NOTE(pabelanger): Read image into memory once and generate both checksum
# files.
md5sum $1 > $1.md5 & sha256sum $1 > $1.sha256 & wait
# NOTE(pabelanger): Read image into memory once and generate
# both checksum files.
# NOTE(ianw): we've seen issues with this waiting for
# our outfilter.py wrapper when containerised (probably due to
# no tty). Waiting for just these processes is a bit of hacky
# workaround ...
declare -a wait_for
md5sum $1 > $1.md5 & wait_for+=($!)
sha256sum $1 > $1.sha256 & wait_for+=($!)
wait "${wait_for[@]}"
fi
echo "Image file $1 created..."
}