From 90719dc82f234655de86533d39c436219d97f9b9 Mon Sep 17 00:00:00 2001 From: Frank Baalbergen Date: Wed, 11 Feb 2015 15:35:05 +0100 Subject: [PATCH] vagrant duplicates >= eth2 when defining two config.vm.network :private_network When a vagrant box has two private network ips /etc/network/interfaces will duplicate eth2 and bigger. sed matches greedy, so the first #VAGRANT-END matches. This will result in: /etc/network/interfaces:29: interface eth2 declared allow-auto twice /sbin/ifup: couldn't read interfaces file "/etc/network/interfaces" --- plugins/guests/debian/cap/configure_networks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/guests/debian/cap/configure_networks.rb b/plugins/guests/debian/cap/configure_networks.rb index 3cb896b15..cf416ec09 100644 --- a/plugins/guests/debian/cap/configure_networks.rb +++ b/plugins/guests/debian/cap/configure_networks.rb @@ -14,7 +14,7 @@ module VagrantPlugins # First, remove any previous network modifications # from the interface file. comm.sudo("sed -e '/^#VAGRANT-BEGIN/,$ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces.pre") - comm.sudo("sed -ne '/^#VAGRANT-END/,$ p' /etc/network/interfaces | tail -n +2 > /tmp/vagrant-network-interfaces.post") + comm.sudo("sed -ne '/^#VAGRANT-END/,$ p' /etc/network/interfaces | tac | sed -e '/^#VAGRANT-END/,$ d' | tac > /tmp/vagrant-network-interfaces.post") # Accumulate the configurations to add to the interfaces file as # well as what interfaces we're actually configuring since we use that