From 3be7ba7c86520f20dcc354be872078250e5831d0 Mon Sep 17 00:00:00 2001 From: downtownallday Date: Wed, 7 Apr 2021 09:24:12 -0400 Subject: [PATCH] Set the default interface for bridged networks to avoid interactive 'vagrant up'. Thx to https://stackoverflow.com/questions/33250304/how-to-automatically-select-bridged-network-interfaces-in-vagrant --- tests/vagrant/funcs.rb | 2 ++ tests/vagrant/vanilla/Vagrantfile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/vagrant/funcs.rb b/tests/vagrant/funcs.rb index 774a030b..5e590c13 100644 --- a/tests/vagrant/funcs.rb +++ b/tests/vagrant/funcs.rb @@ -13,3 +13,5 @@ def use_preloaded_box(obj, name, preloaded_dir=".") end end +# Grab the name of the default interface +$default_network_interface = `ip route | awk '/^default/ {printf "%s", $5; exit 0}'` diff --git a/tests/vagrant/vanilla/Vagrantfile b/tests/vagrant/vanilla/Vagrantfile index fe4f5e33..9df01a03 100644 --- a/tests/vagrant/vanilla/Vagrantfile +++ b/tests/vagrant/vanilla/Vagrantfile @@ -3,7 +3,7 @@ load '../funcs.rb' Vagrant.configure("2") do |config| config.vm.synced_folder "../../..", "/mailinabox", id: "mailinabox", automount: false - config.vm.network "public_network" + config.vm.network "public_network", bridge: "#$default_network_interface" use_preloaded_box config, "ubuntu/bionic64", ".." # vanilla install