~fginther/adt-cloud-worker/uci-nova-swapfile

« back to all changes in this revision

Viewing changes to uci-nova

  • Committer: Ubuntu CI Bot
  • Author(s): Francis Ginther
  • Date: 2015-04-22 13:20:38 UTC
  • mfrom: (8.1.5 wait-for-active)
  • Revision ID: ubuntu_ci_bot-20150422132038-8fsnixm70hlmastj
Wait for nova instance to become ACTIVE before searching for ipaddr. [r=Celso Providelo]

Show diffs side-by-side

added added

removed removed

Lines of Context:
250
250
    retry=60
251
251
    while [ -z "$ipaddr" ]; do
252
252
        OUT=$(nova show --minimal $SRVNAME)
253
 
        ipaddr=$(echo "$OUT" | awk 'BEGIN {FS="|"} /network/ {n=split($3,i,/,\s*/); gsub(" ", "", i[n]); print i[n]}')
 
253
        # Check that the instance is in the 'ACTIVE' state before probing for
 
254
        # the IP address to avoid awk'ing the wrong field
 
255
        if $(echo "$OUT" | grep -q "ACTIVE"); then
 
256
            ipaddr=$(echo "$OUT" | awk 'BEGIN {FS="|"} /network/ {n=split($3,i,/,\s*/); gsub(" ", "", i[n]); print i[n]}')
 
257
        fi
254
258
        retry=$(( retry - 1 ))
255
259
        if [ $retry -le 0 ]; then
256
260
            error "Failed to acquire an IP address. Aborting!"