According to ifconfig(8), to list only Ethernet interfaces, excluding
all other interface types, including the loopback interface, the command
to use should be:
ifconfig -l ether
Related to: #8760
This is a follow-up of #10717 to use the same naming convention as on
Linux guests, in order to reduce the diffs.
Also adds the missing capability to `unmount_virtualbox_shared_folder`
on FreeBSD guests.
Since the virtualbox guest additions seem to only be available for
freeBSD, move the shared folder functionality over to freebsd guests
rather than all BSD guests.
Prior to this commit, when the guest capability attempted to expand a
path with spaces it would quote the path passed in. However if the path
also had a relative path those quotes would end up making `printf`
ignore it and not properly expand the path fully. This commit updates
that to first escape the quotes of a path and then pass in the new path
to be expanded.
Prior to this commit, if a user set the `destination` path to include a
space, the `shell_expand_guest_path` function would remove that space
and return a partial path. This commit updates that to quote the path to
be expanded to preserve the entire path.
This commit refactors the freebsd networking to:
1. Use predictable network naming
2. Properly handle DHCP vs static networks on up and reload [GH-5852]
3. Perform all networking configuration in a single command to prevent
partial configuration.
This fixes a fairly large tempfile leak. Vagrant uses a template
renderer to write network configuration files locally to disk. Then,
that temporarily file is uploaded to the remote host and moved into
place. Since Vagrant is such a short-lived process, GC never came along
and cleaned up those tempfiles, resulting in many temporary files being
created through regular Vagrant usage.
The Util::Tempfile class uses a block to ensure the temporary file is
deleted when the block finishes. This API required small tweaks to the
usage, but provides more safety to ensure the files are deleted.
Sed on freebsd seems to be mores strict than on other
platforms about use of -i: the extension is not optional.
Signed-off-by: Michael Adam <obnox@samba.org>
When using pty=true, removing files using sudo may request confirmation,
which will hang the connection.
Similarly, sometimes assumptions about file existence may be wrong and
in those cases it seems better to continue on as long as the file does
not exist, so -f makes sense there, too.
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.