Networks come back up properly after reboot on RedHat [GH-921]

This commit is contained in:
Mitchell Hashimoto 2013-04-08 11:02:03 -07:00
parent fd157476b4
commit 78d4d0a790
2 changed files with 9 additions and 3 deletions

View File

@ -68,6 +68,7 @@ BUG FIXES:
since they can be quite large and were messing with tmpfs. [GH-1442]
- Fix issue parsing extra SSH args in `vagrant ssh` in multi-machine
environments. [GH-1545]
- Networks come back up properly on RedHat systems after reboot. [GH-921]
## 1.1.6 (April 3, 2013)

View File

@ -1,12 +1,14 @@
require "set"
require "tempfile"
require "vagrant/util/retryable"
require "vagrant/util/template_renderer"
module VagrantPlugins
module GuestRedHat
module Cap
class ConfigureNetworks
extend Vagrant::Util::Retryable
include Vagrant::Util
def self.configure_networks(machine, networks)
@ -43,10 +45,13 @@ module VagrantPlugins
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so
# SSH never dies.
interfaces.each do |interface|
machine.communicate.sudo("/sbin/ifdown eth#{interface} 2> /dev/null", :error_check => false)
machine.communicate.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-eth#{interface}")
retryable(:on => Vagrant::Errors::VagrantError, :tries => 3, :sleep => 2) do
machine.communicate.sudo("/sbin/ifdown eth#{interface} 2> /dev/null", :error_check => false)
machine.communicate.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-eth#{interface}")
machine.communicate.sudo("/sbin/ifup eth#{interface} 2> /dev/null")
end
machine.communicate.sudo("rm /tmp/vagrant-network-entry_#{interface}")
machine.communicate.sudo("/sbin/ifup eth#{interface} 2> /dev/null")
end
end
end