From fc190fad9ff545f201ab9bbeacc59078eebff371 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 26 Nov 2013 11:28:47 -0800 Subject: [PATCH] guests/redhat: DHCP_HOSTNAME set to hostname [GH-2441] --- CHANGELOG.md | 1 + plugins/guests/redhat/cap/change_host_name.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54b3910df..86ede79de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ BUG FIXES: - core: provisoining will properly happen if `up` failed. [GH-2488] - guests/freebsd: Mounting NFS folders works. [GH-2400] - guests/freebsd: Uses `sh` by default for shell. [GH-2485] + - guests/redhat: `DHCP_HOSTNAME` is set to the hostname, not the FQDN. [GH-2441] - guests/redhat: Down interface before messing up configuration file for networking. [GH-1577] - guests/ubuntu: "localhost" is preserved when changing hostnames. diff --git a/plugins/guests/redhat/cap/change_host_name.rb b/plugins/guests/redhat/cap/change_host_name.rb index 967463c3a..3b2fb8051 100644 --- a/plugins/guests/redhat/cap/change_host_name.rb +++ b/plugins/guests/redhat/cap/change_host_name.rb @@ -9,7 +9,7 @@ module VagrantPlugins comm.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network") comm.sudo("hostname #{name}") comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts") - comm.sudo("sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{name}\"/' /etc/sysconfig/network-scripts/ifcfg-*") + comm.sudo("sed -i 's/\\(DHCP_HOSTNAME=\\).*/\\1\"#{name.split('.')[0]}\"/' /etc/sysconfig/network-scripts/ifcfg-*") comm.sudo("service network restart") end end