Fix bashate issues
This commit is contained in:
parent
50336185d9
commit
d06057ef6b
@ -7,34 +7,34 @@ MANILA_USER_HOME="/home/$MANILA_USER"
|
||||
MANILA_USER_SSH_DIR="$MANILA_USER_HOME/.ssh"
|
||||
|
||||
if [ ! -d $MANILA_USER_SSH_DIR ]; then
|
||||
mkdir -p $MANILA_USER_SSH_DIR
|
||||
chmod 700 $MANILA_USER_SSH_DIR
|
||||
chown -R $MANILA_USER $MANILA_USER_SSH_DIR
|
||||
mkdir -p $MANILA_USER_SSH_DIR
|
||||
chmod 700 $MANILA_USER_SSH_DIR
|
||||
chown -R $MANILA_USER $MANILA_USER_SSH_DIR
|
||||
fi
|
||||
|
||||
# Fetch public key using HTTP
|
||||
ATTEMPTS=10
|
||||
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
|
||||
if [ $? -eq 0 ]; then
|
||||
cat /tmp/metadata-key >> $MANILA_USER_SSH_DIR/authorized_keys
|
||||
chmod 0600 $MANILA_USER_SSH_DIR/authorized_keys
|
||||
chown $MANILA_USER $MANILA_USER_SSH_DIR/authorized_keys
|
||||
rm -f /tmp/metadata-key
|
||||
echo "Successfully retrieved public key from instance metadata"
|
||||
echo "*****************"
|
||||
echo "AUTHORIZED KEYS"
|
||||
echo "*****************"
|
||||
cat $MANILA_USER_SSH_DIR/authorized_keys
|
||||
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
|
||||
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
|
||||
cat /tmp/metadata-key >> $MANILA_USER_SSH_DIR/authorized_keys
|
||||
chmod 0600 $MANILA_USER_SSH_DIR/authorized_keys
|
||||
chown $MANILA_USER $MANILA_USER_SSH_DIR/authorized_keys
|
||||
rm -f /tmp/metadata-key
|
||||
echo "Successfully retrieved public key from instance metadata"
|
||||
echo "*****************"
|
||||
echo "AUTHORIZED KEYS"
|
||||
echo "*****************"
|
||||
cat $MANILA_USER_SSH_DIR/authorized_keys
|
||||
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
|
||||
echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..."
|
||||
sleep 5
|
||||
fi
|
||||
done
|
@ -21,7 +21,7 @@ CACHED_FILE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
|
||||
CACHED_FILE_LOCK=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE.lock
|
||||
CACHED_SUMS=$DIB_IMAGE_CACHE/SHA256SUMS.ubuntu.$DIB_RELEASE.$ARCH
|
||||
|
||||
function get_ubuntu_tarball() {
|
||||
function get_ubuntu_tarball {
|
||||
if [ -n "$DIB_OFFLINE" -a -f "$CACHED_FILE" ] ; then
|
||||
echo "Not checking freshness of cached $CACHED_FILE."
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user