Avoid silent parsing failure of provisioned.csv
Removes header from cico output to avoid `tail -1` to get column header (ip_address) as hostname when the list would be empty (one line file). It returns failure exit code when no nodes are provisioned. It avoids case where column header "ip_address" ended up being loaded in VIRTHOST variable. Closes-Bug: #1790685 Change-Id: I4a78ef1071c35491c352203aac35eb22ef1dc637
This commit is contained in:
parent
ebf1d67e45
commit
a35d6ceb1f
|
@ -23,10 +23,15 @@ $WORKSPACE/bin/cico node get \
|
||||||
--count 1 \
|
--count 1 \
|
||||||
--retry-count 6 \
|
--retry-count 6 \
|
||||||
--retry-interval 60 \
|
--retry-interval 60 \
|
||||||
-f csv > $WORKSPACE/provisioned.csv
|
-f csv | sed "1d" > $WORKSPACE/provisioned.csv
|
||||||
|
|
||||||
$WORKSPACE/bin/cico inventory
|
$WORKSPACE/bin/cico inventory
|
||||||
cat $WORKSPACE/provisioned.csv
|
if [ -s $WORKSPACE/provisioned.csv ]; then
|
||||||
|
cat $WORKSPACE/provisioned.csv
|
||||||
|
else
|
||||||
|
echo "FATAL: no nodes were provisioned"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
export VIRTHOST=`cat provisioned.csv | tail -1 | cut -d "," -f 3| sed -e 's/"//g'`
|
export VIRTHOST=`cat provisioned.csv | tail -1 | cut -d "," -f 3| sed -e 's/"//g'`
|
||||||
export VIRTHOST_KEY=`cat provisioned.csv | tail -1 | cut -d "," -f 7| sed -e 's/"//g'`
|
export VIRTHOST_KEY=`cat provisioned.csv | tail -1 | cut -d "," -f 7| sed -e 's/"//g'`
|
||||||
|
|
Loading…
Reference in New Issue