mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-10 01:17:19 +00:00
Workaround vagrant's inability to authenticate during vagrant up (but can authenticate with vagrant ssh)
This commit is contained in:
parent
e5ba7f8ceb
commit
ee1ffbdb21
1
tests/vagrant/preloaded/Vagrantfile
vendored
1
tests/vagrant/preloaded/Vagrantfile
vendored
@ -30,6 +30,7 @@ SH
|
|||||||
|
|
||||||
config.vm.define "preloaded-ubuntu-jammy64" do |m1|
|
config.vm.define "preloaded-ubuntu-jammy64" do |m1|
|
||||||
m1.vm.box = "ubuntu/jammy64"
|
m1.vm.box = "ubuntu/jammy64"
|
||||||
|
m1.vm.boot_timeout = 30
|
||||||
m1.vm.provision :shell, :inline => <<-SH
|
m1.vm.provision :shell, :inline => <<-SH
|
||||||
cd /mailinabox
|
cd /mailinabox
|
||||||
tests/vagrant/preloaded/prepvm.sh --no-dry-run
|
tests/vagrant/preloaded/prepvm.sh --no-dry-run
|
||||||
|
@ -45,10 +45,26 @@ do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
export RELEASE_TAG="${tags[$idx]}"
|
export RELEASE_TAG="${tags[$idx]}"
|
||||||
vagrant up $box
|
vagrant up $box | tee /tmp/$box.out
|
||||||
upcode=$?
|
upcode=$?
|
||||||
|
|
||||||
|
if [ $upcode -eq 0 -a ! -e "./prepcode.txt" ] && ${try_reboot[$idx]} && grep -F 'Authentication failure' /tmp/$box.out >/dev/null; then
|
||||||
|
# note: upcode is 0 only if config.vm.boot_timeout is set.
|
||||||
|
# If this works it may be an indication that ruby's internal
|
||||||
|
# ssh does not support the algorithm required by the server,
|
||||||
|
# or the public key does not match (vagrant and vm out of
|
||||||
|
# sync)
|
||||||
|
echo ""
|
||||||
|
echo "VAGRANT AUTHENTICATION FAILURE - TRYING LOOSER ALLOWED SSHD ALGS"
|
||||||
|
if vagrant ssh $box -c "sudo bash -c 'echo PubkeyAcceptedAlgorithms +ssh-rsa > /etc/ssh/sshd_config.d/miabldap.conf; sudo systemctl restart sshd'"; then
|
||||||
|
vagrant halt $box
|
||||||
|
vagrant up $box
|
||||||
|
upcode=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $upcode -ne 0 -a ! -e "./prepcode.txt" ] && ${try_reboot[$idx]}
|
if [ $upcode -ne 0 -a ! -e "./prepcode.txt" ] && ${try_reboot[$idx]}
|
||||||
then
|
then
|
||||||
# a reboot may be necessary if guest addtions was newly
|
# a reboot may be necessary if guest addtions was newly
|
||||||
# compiled by vagrant plugin "vagrant-vbguest"
|
# compiled by vagrant plugin "vagrant-vbguest"
|
||||||
echo ""
|
echo ""
|
||||||
@ -57,6 +73,8 @@ do
|
|||||||
vagrant up $box
|
vagrant up $box
|
||||||
upcode=$?
|
upcode=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f /tmp/$box.out
|
||||||
|
|
||||||
let idx+=1
|
let idx+=1
|
||||||
prepcode=$(cat "./prepcode.txt")
|
prepcode=$(cat "./prepcode.txt")
|
||||||
@ -71,8 +89,11 @@ do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if vagrant ssh $box -- cat /var/run/reboot-required; then
|
if vagrant ssh $box -- cat /var/run/reboot-required >/dev/null 2>&1; then
|
||||||
|
echo "REBOOT REQUIRED"
|
||||||
vagrant reload $box
|
vagrant reload $box
|
||||||
|
else
|
||||||
|
echo "REBOOT NOT REQUIRED"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
vagrant halt $box
|
vagrant halt $box
|
||||||
|
Loading…
Reference in New Issue
Block a user