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.
This commit is contained in:
@@ -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})
|
||||
|
Reference in New Issue
Block a user