Fix template paths for other guests

This commit is contained in:
Mitchell Hashimoto 2011-12-31 19:08:56 -08:00
parent dd84b88685
commit c48a31d6bd
9 changed files with 25 additions and 28 deletions

View File

@ -14,13 +14,14 @@ module Vagrant
def prepare_host_only_network(net_options=nil) def prepare_host_only_network(net_options=nil)
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|
ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf > /tmp/vagrant-network-interfaces") ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN-HOSTONLY/,/^#VAGRANT-END-HOSTONLY/ d' /etc/rc.conf > /tmp/vagrant-network-interfaces")
ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/rc.conf'") ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/rc.conf'")
end end
end end
def enable_host_only_network(net_options) def enable_host_only_network(net_options)
entry = TemplateRenderer.render('network_entry_arch', :net_options => net_options) entry = TemplateRenderer.render('guests/arch/network_hostonly',
:net_options => net_options)
vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry") vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|

View File

@ -63,13 +63,13 @@ module Vagrant
# interface file. # interface file.
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|
# Clear out any previous entries # Clear out any previous entries
ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf > /tmp/rc.conf") ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN-HOSTONLY/,/^#VAGRANT-END-HOSTONLY/ d' /etc/rc.conf > /tmp/rc.conf")
ssh.exec!("sudo mv /tmp/rc.conf /etc/rc.conf") ssh.exec!("sudo mv /tmp/rc.conf /etc/rc.conf")
end end
end end
def enable_host_only_network(net_options) def enable_host_only_network(net_options)
entry = "#VAGRANT-BEGIN\nifconfig_em#{net_options[:adapter]}=\"inet #{net_options[:ip]} netmask #{net_options[:netmask]}\"\n#VAGRANT-END\n" entry = "#VAGRANT-BEGIN-HOSTONLY\nifconfig_em#{net_options[:adapter]}=\"inet #{net_options[:ip]} netmask #{net_options[:netmask]}\"\n#VAGRANT-END-HOSTONLY\n"
vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry") vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|

View File

@ -5,14 +5,14 @@ module Vagrant
# Remove any previous host only network additions to the # Remove any previous host only network additions to the
# interface file. # interface file.
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|
# Clear out any previous entries ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN-HOSTONLY/,/^#VAGRANT-END-HOSTONLY/ d' /etc/conf.d/net > /tmp/vagrant-network-interfaces")
ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/conf.d/net > /tmp/vagrant-network-interfaces")
ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/conf.d/net'") ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/conf.d/net'")
end end
end end
def enable_host_only_network(net_options) def enable_host_only_network(net_options)
entry = TemplateRenderer.render('network_entry_gentoo', :net_options => net_options) entry = TemplateRenderer.render('guests/gentoo/network_hostonly',
:net_options => net_options)
vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry") vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|

View File

@ -7,14 +7,14 @@ module Vagrant
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|
# Clear out any previous entries # Clear out any previous entries
ssh.exec!("sudo touch #{network_scripts_dir}/ifcfg-eth#{net_options[:adapter]}") ssh.exec!("sudo touch #{network_scripts_dir}/ifcfg-eth#{net_options[:adapter]}")
ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' #{network_scripts_dir}/ifcfg-eth#{net_options[:adapter]} > /tmp/vagrant-ifcfg-eth#{net_options[:adapter]}") ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN-HOSTONLY/,/^#VAGRANT-END-HOSTONLY/ d' #{network_scripts_dir}/ifcfg-eth#{net_options[:adapter]} > /tmp/vagrant-ifcfg-eth#{net_options[:adapter]}")
ssh.exec!("sudo su -c 'cat /tmp/vagrant-ifcfg-eth#{net_options[:adapter]} > #{network_scripts_dir}/ifcfg-eth#{net_options[:adapter]}'") ssh.exec!("sudo su -c 'cat /tmp/vagrant-ifcfg-eth#{net_options[:adapter]} > #{network_scripts_dir}/ifcfg-eth#{net_options[:adapter]}'")
end end
end end
def enable_host_only_network(net_options) def enable_host_only_network(net_options)
entry = TemplateRenderer.render('network_entry_redhat', :net_options => net_options) entry = TemplateRenderer.render('guests/redhat/network_hostonly',
:net_options => net_options)
vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry") vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")
vm.ssh.execute do |ssh| vm.ssh.execute do |ssh|

View File

@ -0,0 +1,7 @@
#VAGRANT-BEGIN-HOSTONLY
# The contents below are automatically generated by Vagrant. Do not modify.
interface=eth<%= net_options[:adapter] %>
address=<%= net_options[:ip]%>
netmask=<%= net_options[:netmask] %>
gateway=
#VAGRANT-END-HOSTONLY

View File

@ -0,0 +1,4 @@
#VAGRANT-BEGIN-HOSTONLY
# The contents below are automatically generated by Vagrant. Do not modify.
config_eth<%= net_options[:adapter] %>=("<%= net_options[:ip] %> netmask <%= net_options[:netmask] %>")
#VAGRANT-END-HOSTONLY

View File

@ -1,9 +1,8 @@
#VAGRANT-BEGIN #VAGRANT-BEGIN-HOSTONLY
# The contents below are automatically generated by Vagrant. # The contents below are automatically generated by Vagrant. Do not modify.
# Please do not modify any of these contents.
BOOTPROTO=static BOOTPROTO=static
DHCPCLASS= DHCPCLASS=
IPADDR=<%= net_options[:ip] %> IPADDR=<%= net_options[:ip] %>
NETMASK=<%= net_options[:netmask] %> NETMASK=<%= net_options[:netmask] %>
DEVICE=eth<%= net_options[:adapter] %> DEVICE=eth<%= net_options[:adapter] %>
#VAGRANT-END #VAGRANT-END-HOSTONLY

View File

@ -1,9 +0,0 @@
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant.
# Please do not modify any of these contents.
interface=eth<%= net_options[:adapter] %>
address=<%= net_options[:ip]%>
netmask=<%= net_options[:netmask] %>
gateway=
#VAGRANT-END

View File

@ -1,5 +0,0 @@
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant.
# Please do not modify any of these contents.
config_eth<%= net_options[:adapter] %>=("<%= net_options[:ip] %> netmask <%= net_options[:netmask] %>")
#VAGRANT-END