guests/redhat: don't ifdown non-existent interfaces [GH-2614]

This commit is contained in:
Mitchell Hashimoto 2013-12-10 09:04:20 -08:00
parent 4b191e1595
commit 05b2e03586
2 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,8 @@ BUG FIXES:
dots [GH-2610]
- guests/freebsd: configuring networks in the guest works properly
[GH-2620]
- guests/redhat: fix configure networks bringing down interfaces that
don't exist. [GH-2614]
## 1.4.0 (December 9, 2013)

View File

@ -51,8 +51,12 @@ module VagrantPlugins
# SSH never dies.
interfaces.each do |interface|
retryable(:on => Vagrant::Errors::VagrantError, :tries => 3, :sleep => 2) do
# The interface should already be down
machine.communicate.sudo("/sbin/ifdown eth#{interface} 2> /dev/null")
# The interface should already be down so this probably
# won't do anything, so we run it with error_check false.j
machine.communicate.sudo(
"/sbin/ifdown eth#{interface} 2> /dev/null", error_check: false)
# Add the new interface and bring it up
machine.communicate.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-eth#{interface}")
machine.communicate.sudo("ARPCHECK=no /sbin/ifup eth#{interface} 2> /dev/null")
end