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.
This commit is contained in:
smoyer 2014-01-08 17:49:54 -05:00
parent 010874ffad
commit 3964298504
2 changed files with 18 additions and 11 deletions

View File

@ -49,7 +49,7 @@ module VagrantPlugins
end
def update_hostname
sudo "hostname #{short_hostname}"
sudo "hostname #{fqdn}"
end
# /etc/hosts should resemble:

View File

@ -1,9 +1,5 @@
shared_examples 'a partial redhat-like host name change' do
shared_examples 'shared between newhostname styles' do
it 'updates hostname on the machine with the new short hostname' do
communicator.expect_command(%q(hostname newhostname))
described_class.change_host_name(machine, new_hostname)
end
it 'sets dhcp_hostname with the provided short hostname' do
communicator.expect_command(%q(sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1"newhostname"/' /etc/sysconfig/network-scripts/ifcfg-*))
@ -25,6 +21,11 @@ shared_examples 'a partial redhat-like host name change' do
communicator.expect_command(%q(sed -i 's/\\(HOSTNAME=\\).*/\\1newhostname.newdomain.tld/' /etc/sysconfig/network))
described_class.change_host_name(machine, new_hostname)
end
it 'updates hostname on the machine with the new hostname' do
communicator.expect_command(%q(hostname newhostname.newdomain.tld))
described_class.change_host_name(machine, new_hostname)
end
end
context 'when newhostname is simple' do
@ -36,6 +37,12 @@ shared_examples 'a partial redhat-like host name change' do
communicator.expect_command(%q(sed -i 's/\\(HOSTNAME=\\).*/\\1newhostname/' /etc/sysconfig/network))
described_class.change_host_name(machine, new_hostname)
end
it 'updates hostname on the machine with the new hostname' do
communicator.expect_command(%q(hostname newhostname))
described_class.change_host_name(machine, new_hostname)
end
end
end