Merge "Fixes the custom script to fetch the public key."
This commit is contained in:
commit
790524e196
@ -244,10 +244,10 @@ fi
|
|||||||
|
|
||||||
# Fetch public key using HTTP
|
# Fetch public key using HTTP
|
||||||
ATTEMPTS=30
|
ATTEMPTS=30
|
||||||
FAILED=0subl
|
FAILED=0
|
||||||
while [ ! -f /root/.ssh/authorized_keys ]; do
|
while [ ! -f /root/.ssh/authorized_keys ]; do
|
||||||
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/metadata-key 2>/dev/null
|
curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/metadata-key 2>/dev/null
|
||||||
if [ \$? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
cat /tmp/metadata-key >> /root/.ssh/authorized_keys
|
cat /tmp/metadata-key >> /root/.ssh/authorized_keys
|
||||||
chmod 0600 /root/.ssh/authorized_keys
|
chmod 0600 /root/.ssh/authorized_keys
|
||||||
restorecon /root/.ssh/authorized_keys
|
restorecon /root/.ssh/authorized_keys
|
||||||
@ -258,6 +258,15 @@ while [ ! -f /root/.ssh/authorized_keys ]; do
|
|||||||
echo "*****************"
|
echo "*****************"
|
||||||
cat /root/.ssh/authorized_keys
|
cat /root/.ssh/authorized_keys
|
||||||
echo "*****************"
|
echo "*****************"
|
||||||
|
else
|
||||||
|
FAILED=`expr $FAILED + 1`
|
||||||
|
if [ $FAILED -ge $ATTEMPTS ]; then
|
||||||
|
echo "Failed to retrieve public key from instance metadata after $FAILED attempts, quitting"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..."
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
done</programlisting>
|
done</programlisting>
|
||||||
<note>
|
<note>
|
||||||
<para>Some VNC clients replace : (colon) with ; (semicolon) and _ (underscore) with
|
<para>Some VNC clients replace : (colon) with ; (semicolon) and _ (underscore) with
|
||||||
|
Loading…
x
Reference in New Issue
Block a user