Make mounting of EFS more stable
When mouting the EFS volume its url might not resolve yet.
Retry until it is possible to mount it.
Change-Id: I6373faa47a60cb978065049a15dae38fe4a14958
diff --git a/dual-master/cf-cluster.yml b/dual-master/cf-cluster.yml
index 2f3c100..24d1b31 100644
--- a/dual-master/cf-cluster.yml
+++ b/dual-master/cf-cluster.yml
@@ -159,7 +159,12 @@
echo $EC2_REGION >> /home/ec2-user/echo.res
echo $DIR_SRC >> /home/ec2-user/echo.res
echo $DIR_TGT >> /home/ec2-user/echo.res
- mount -t nfs4 -o nfsvers=4.1,hard,timeo=600,retrans=2 $DIR_SRC:/ $DIR_TGT >> /home/ec2-user/echo.res
+ MAX_RETRIES=5
+ for i in $(seq 1 $MAX_RETRIES); do
+ echo "Mounting EFS volume ($i/$MAX_RETRIES)..."
+ `mount -t nfs4 -o nfsvers=4.1,hard,timeo=600,retrans=2 $DIR_SRC:/ $DIR_TGT >> /home/ec2-user/echo.res` \
+ && s=0 && break || s=$? && sleep 5;
+ done; (exit $s)
mkdir $DIR_TGT/git
chown -R 1000:1000 $DIR_TGT
cp -p /etc/fstab /etc/fstab.back-$(date +%F)