From: Adam Israel Date: Thu, 15 Feb 2018 19:00:36 +0000 (-0500) Subject: Fix race condition X-Git-Tag: v3.0.3~14 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F51%2F5851%2F2;p=osm%2Fdevops.git Fix race condition This fixes a race condition where cloud-init may not be finished before we try to run apt-get update, causing the script to fail. Fixes bug #463 Signed-off-by: Adam Israel Change-Id: I241d769bb5d3f07d1ede628df58f7949649eefd9 --- diff --git a/jenkins/VCA/update-lxd-image.sh b/jenkins/VCA/update-lxd-image.sh index ae692f65..9cc15365 100755 --- a/jenkins/VCA/update-lxd-image.sh +++ b/jenkins/VCA/update-lxd-image.sh @@ -35,6 +35,9 @@ function cache() { # Wait for the container to get an IP address lxc exec $container -- bash -c "for i in {1..60}; do sleep 1; ping -c1 10.44.127.1 &> /dev/null && break; done" + # Wait for cloud-init to finish + lxc exec $container -- bash -c "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do sleep 1; done" + lxc exec $container -- apt-get update -y lxc exec $container -- apt-get upgrade -y lxc exec $container -- apt-get install -y $PACKAGES $2