Skip to content

Commit

Permalink
AWS: Don't error if there are no ephemeral disks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
justinsb committed Apr 2, 2016
1 parent 9b0ea8f commit 1c3f706
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cluster/aws/templates/format-disks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit 1c3f706

Please sign in to comment.