From 36ff48082d030c29850d3a49bfd0a9d8d245bfa4 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Fri, 5 Jun 2015 13:56:29 +0300 Subject: [PATCH] Update fetch-public-ssh-keys.sh Increase timeout and exit on error. --- elements/manila-ssh/install.d/fetch-public-ssh-keys.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elements/manila-ssh/install.d/fetch-public-ssh-keys.sh b/elements/manila-ssh/install.d/fetch-public-ssh-keys.sh index 32e9636..55e7d84 100755 --- a/elements/manila-ssh/install.d/fetch-public-ssh-keys.sh +++ b/elements/manila-ssh/install.d/fetch-public-ssh-keys.sh @@ -13,7 +13,7 @@ if [ ! -d $MANILA_USER_SSH_DIR ]; then fi # Fetch public key using HTTP -ATTEMPTS=30 +ATTEMPTS=60 # Wait up to 5 minutes FAILED=0 while [ ! -f $MANILA_USER_SSH_DIR/authorized_keys ]; do curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/metadata-key 2>/dev/null @@ -32,7 +32,7 @@ while [ ! -f $MANILA_USER_SSH_DIR/authorized_keys ]; do FAILED=`expr $FAILED + 1` if [ $FAILED -ge $ATTEMPTS ]; then echo "Failed to retrieve public key from instance metadata after $FAILED attempts, quitting" - break + exit 1 fi echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..." sleep 5