Fix Issue 4307: FreeBSD fix interface device names in /etc/rc.conf

https://github.com/mitchellh/vagrant/issues/4307

Fix details:
Pass network interface name to template renderer and use it
in static and dhcp templates to render /etc/rc.conf entries.

  modified:   plugins/guests/freebsd/cap/configure_networks.rb
  modified:   templates/guests/freebsd/network_dhcp.erb
  modified:   templates/guests/freebsd/network_static.erb

Verification scenario:
Check if /etc/rc.conf contains vtnet entries when paravirtualized
NIC devices are used in FreeBSD guest.
This commit is contained in:
Kostyantyn Fomin 2014-08-06 14:10:05 -07:00
parent ac0d213c9b
commit c43ab95f86
3 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ module VagrantPlugins
end
entry = TemplateRenderer.render("guests/freebsd/network_#{network[:type]}",
options: network)
options: network, ifname: ifname)
# Write the entry to a temporary location
temp = Tempfile.new("vagrant")

View File

@ -1,3 +1,3 @@
#VAGRANT-BEGIN
ifconfig_em<%= options[:interface] %>="DHCP"
ifconfig_em<%= ifname %>="DHCP"
#VAGRANT-END

View File

@ -1,3 +1,3 @@
#VAGRANT-BEGIN
ifconfig_em<%= options[:interface] %>="inet <%= options[:ip] %> netmask <%= options[:netmask] %>"
ifconfig_<%= ifname %>="inet <%= options[:ip] %> netmask <%= options[:netmask] %>"
#VAGRANT-END