This fixes an issue when the interface being configured is the
interface through which ssh traffic is forwarded.
In a complex scenario, one needs to disable the default interface for
NAT, and use other interface for ssh. In this case, when vagrant run
`ifconfig #{ifname} inet delete`, the second ifconfig that is supposed
to restore interface settings will never be called. This might be a rare
need, but it is also strongly recommended to use `netstart` when
reconfiguring interfaces after updating `hostname.if(5)`.
The issue can be triggered when ssh connection has issues between two
`ifconfig` commands.
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.