Merge pull request #3303 from barrkel/dont-reorder-network-interface-configuration

Don't reorder config in /etc/network/interfaces
This commit is contained in:
Seth Vargo 2014-12-15 14:36:59 -05:00
commit 686e940a84
1 changed files with 4 additions and 5 deletions

View File

@ -13,9 +13,8 @@ module VagrantPlugins
machine.communicate.tap do |comm| machine.communicate.tap do |comm|
# First, remove any previous network modifications # First, remove any previous network modifications
# from the interface file. # from the interface file.
comm.sudo("sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces") comm.sudo("sed -e '/^#VAGRANT-BEGIN/,$ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces.pre")
comm.sudo("su -c 'cat /tmp/vagrant-network-interfaces > /etc/network/interfaces'") comm.sudo("sed -ne '/^#VAGRANT-END/,$ p' /etc/network/interfaces | tail -n +2 > /tmp/vagrant-network-interfaces.post")
comm.sudo("rm -f /tmp/vagrant-network-interfaces")
# Accumulate the configurations to add to the interfaces file as # Accumulate the configurations to add to the interfaces file as
# well as what interfaces we're actually configuring since we use that # well as what interfaces we're actually configuring since we use that
@ -47,8 +46,8 @@ module VagrantPlugins
comm.sudo("/sbin/ip addr flush dev eth#{interface} 2> /dev/null") comm.sudo("/sbin/ip addr flush dev eth#{interface} 2> /dev/null")
end end
comm.sudo("cat /tmp/vagrant-network-entry >> /etc/network/interfaces") comm.sudo('cat /tmp/vagrant-network-interfaces.pre /tmp/vagrant-network-entry /tmp/vagrant-network-interfaces.post > /etc/network/interfaces')
comm.sudo("rm -f /tmp/vagrant-network-entry") comm.sudo('rm -f /tmp/vagrant-network-interfaces.pre /tmp/vagrant-network-entry /tmp/vagrant-network-interfaces.post')
# Bring back up each network interface, reconfigured # Bring back up each network interface, reconfigured
interfaces.each do |interface| interfaces.each do |interface|