Commit Graph

4 Commits

Author SHA1 Message Date
smoyer 3964298504 This was introduced in 1.4.1 with d26c147.
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.
2014-01-08 17:49:54 -05:00
Charlie Huggard 0e2b7a7c0b Unit tests for ChangeHostName on Enterprise Linux 2013-12-16 01:57:11 -06:00
Paul Hinze abe0731d2e guests/{ubuntu,debian}: fix change_host_name for trailing dots [GH-2610]
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.
2013-12-09 18:56:45 -06:00
phinze 688bca14f5 refactoring ubuntu/debian change_host_name
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
2013-11-24 11:46:12 -06:00