Code style for RedHat network configurations
This commit is contained in:
parent
a04fce880c
commit
fc3bb6ca92
|
@ -27,7 +27,7 @@ module Vagrant
|
||||||
:options => network)
|
:options => network)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Perform the careful dance necessary to to reconfigure
|
# Perform the careful dance necessary to reconfigure
|
||||||
# the network interfaces
|
# the network interfaces
|
||||||
vm.ssh.upload!(StringIO.new(entries.join("\n")), "/tmp/vagrant-network-entry")
|
vm.ssh.upload!(StringIO.new(entries.join("\n")), "/tmp/vagrant-network-entry")
|
||||||
|
|
||||||
|
|
|
@ -13,29 +13,25 @@ module Vagrant
|
||||||
# well as what interfaces we're actually configuring since we use that
|
# well as what interfaces we're actually configuring since we use that
|
||||||
# later.
|
# later.
|
||||||
interfaces = Set.new
|
interfaces = Set.new
|
||||||
|
|
||||||
# Since redhat/centos uses a single file for each interface,
|
|
||||||
# we must loop through for each network assigned
|
|
||||||
networks.each do |network|
|
networks.each do |network|
|
||||||
interfaces.add(network[:interface])
|
interfaces.add(network[:interface])
|
||||||
|
|
||||||
# First, remove any previous network modifications
|
# Remove any previous vagrant configuration in this network interface's
|
||||||
# from the interface file.
|
# configuration files.
|
||||||
vm.ssh.execute do |ssh|
|
vm.ssh.execute do |ssh|
|
||||||
ssh.exec!("sudo touch #{network_scripts_dir}/ifcfg-eth#{network[:interface]}")
|
ssh.exec!("sudo touch #{network_scripts_dir}/ifcfg-eth#{network[:interface]}")
|
||||||
ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' #{network_scripts_dir}/ifcfg-eth#{network[:interface]} > /tmp/vagrant-ifcfg-eth#{network[:interface]}")
|
ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' #{network_scripts_dir}/ifcfg-eth#{network[:interface]} > /tmp/vagrant-ifcfg-eth#{network[:interface]}")
|
||||||
ssh.exec!("sudo su -c 'cat /tmp/vagrant-ifcfg-eth#{network[:interface]} > #{network_scripts_dir}/ifcfg-eth#{network[:interface]}'")
|
ssh.exec!("sudo su -c 'cat /tmp/vagrant-ifcfg-eth#{network[:interface]} > #{network_scripts_dir}/ifcfg-eth#{network[:interface]}'")
|
||||||
end
|
end
|
||||||
|
|
||||||
entry = ""
|
# Render and upload the network entry file to a deterministic
|
||||||
entry << TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
|
# temporary location.
|
||||||
:options => network)
|
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
|
||||||
|
:options => network)
|
||||||
# Perform the careful dance necessary to to reconfigure
|
|
||||||
# the network interfaces
|
|
||||||
vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry_#{network[:interface]}")
|
vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry_#{network[:interface]}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Perform the careful dance necessary to reconfigure the network interfaces
|
||||||
vm.ssh.execute do |ssh|
|
vm.ssh.execute do |ssh|
|
||||||
# Bring down all the interfaces we're reconfiguring. By bringing down
|
# Bring down all the interfaces we're reconfiguring. By bringing down
|
||||||
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so
|
# each specifically, we avoid reconfiguring eth0 (the NAT interface) so
|
||||||
|
|
Loading…
Reference in New Issue