diff --git a/packer/scripts/common/vagrant.sh b/packer/scripts/common/vagrant.sh index cfb0ff2d6..4dadf6aee 100644 --- a/packer/scripts/common/vagrant.sh +++ b/packer/scripts/common/vagrant.sh @@ -4,5 +4,12 @@ mkdir /home/vagrant/.ssh wget --no-check-certificate \ 'https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub' \ -O /home/vagrant/.ssh/authorized_keys + +# Guard for empty authorized_keys file, wget with error creates an empty file +if [ ! -s /home/vagrant/.ssh/authorized_keys ]; then + echo "Unable to download Vagrant public key" + exit 1 +fi + chown -R vagrant /home/vagrant/.ssh chmod -R go-rwsx /home/vagrant/.ssh