AWS: Don't error if there are no ephemeral disks

format-disks used to run with non-strict bash semantics, but this changed in
1.2 as we now merge it into the GCE script, so pipefail and errexit are both
set.

However, the way we list the ephemeral disks, by piping to grep, would cause an
exit code of 2 if there were no ephemeral disks.

Tolerate failure here by add `|| true`.  The metadata service call is unlikely
to fail, so we continue to ignore that possibility.
pull/6/head
Justin Santa Barbara 2016-04-01 22:05:14 -04:00
parent 9b0ea8ff78
commit 1c3f706383
1 changed files with 1 additions and 1 deletions

View File

@ -26,7 +26,7 @@ fi
block_devices=()
ephemeral_devices=$(curl --silent http://169.254.169.254/2014-11-05/meta-data/block-device-mapping/ | grep ephemeral)
ephemeral_devices=$( (curl --silent http://169.254.169.254/2014-11-05/meta-data/block-device-mapping/ | grep ephemeral) || true )
for ephemeral_device in $ephemeral_devices; do
echo "Checking ephemeral device: ${ephemeral_device}"
aws_device=$(curl --silent http://169.254.169.254/2014-11-05/meta-data/block-device-mapping/${ephemeral_device})