This PR sets the active hostname back to the name specified in the Vagrantfile (fqdn) and updates the unit tests.
Setting it to the short name causes loads of problems while configuring the system. I've had issues with sudoers hostname matching, Weblogic certificate generation and a few others. Even if I changed all of the Chef recipes, the fqdn is set in /etc/sysconfig/network so the active hostname will switch to the fqdn after a reboot.
Since vbox guest properties are proving to be less reliable than we had
hoped, bring back the static config parsing mechanism for finding a
guest IP to hand to NFS. If we find a static IP (or set of IPs) we'll
use that instead of trying to probe guest properties.
This retains NFS support for DHCP interfaces while regaining the
reliability that we previously had when static IPs were required.
When `/etc/hosts` contained a FQDN with a trailing dot, the `\b` in the
sed expression would not match, since dot is not considered to be a word
character.
Fix this by regexp-escaping the hostname search, and matching the end of
the line on optional space followed by additional characters.
Also add some tests that extract the regexp used by sed and verify that
it does what we want. These will hopefully serve us in the future if we
ever need to test additional edge cases.
since we merged multiple private keys, the :private_key_path item of
ssh_info now comes back as an array. the ssh-config command had not yet
been updated to handle this properly.
here we fix that oversight and add a few unit tests around the config
generation.
Previously, we required a host-only interface with a static IP for NFS
to work in VirtualBox, because we needed access to the guest's IP in
order to properly configure mount commands.
After boot, VirtualBox exposes the IP addresses of a guest's network
adapters via the "guestproperty" interface.
This adds support for reading VirtualBox guest properties to the
VirtualBox driver and utilizes that support to prepare NFS settings,
which removes the necessity for a static IP for NFS to work.
In this commit we also start building out scaffolding for unit testing
vbox actions and drivers.
Test plan:
- Prepare a Vagrantfile with the following:
* private network with type: :dhcp
* synced folder with nfs: true
- Boot a VM from this Vagrantfile using the virtualbox provider
- Machine should boot successfully with working synced folder
The logic change in 57d4775140 introduced
a bug where neither strings nor arrays provided as `args` for shell
provisioners would pass validation.
This fixes that problem along with a few extras:
- split out arg validation into a private method
- update comment describing valid args
- add a few unit tests around config validation
there's been a lot of churn around this code, so i figure it was worth
trying to clean it up.
- the methods were doing a lot, so make them into template methods with
one helper per step
- spread out /etc/hosts regexp into a couple of helper variables for
clarity
- remove handling for broken hostname implementations (like basing all
of the checks on name.split('.')[0]), since it seems reasonable to
remove code dedicated only to handling broken boxes
- DRY up the shared code between debian/ubuntu implementations, which
clarifies the differences as well
- add unit tests around the behavior; this will help us in the future
to separate flaws in our understanding from flaws in implementation
- includes a new DummyCommunicator in tests which should be useful in
supporting additional unit testing of this kind
- manually tested this on squeeze, wheezy, precise, quantal, raring,
and saucy successfully.
handles the issue in #2333