More robust hostname checking for RedHat [GH-1566]
This commit is contained in:
parent
5690aef4b0
commit
ba07d303e5
|
@ -79,6 +79,7 @@ BUG FIXES:
|
||||||
is not created. [GH-1562]
|
is not created. [GH-1562]
|
||||||
- Multiple machines defined in the same Vagrantfile with the same
|
- Multiple machines defined in the same Vagrantfile with the same
|
||||||
name will properly merge.
|
name will properly merge.
|
||||||
|
- More robust hostname checking for RedHat. [GH-1566]
|
||||||
|
|
||||||
## 1.1.6 (April 3, 2013)
|
## 1.1.6 (April 3, 2013)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ module VagrantPlugins
|
||||||
def self.change_host_name(machine, name)
|
def self.change_host_name(machine, name)
|
||||||
machine.communicate.tap do |comm|
|
machine.communicate.tap do |comm|
|
||||||
# Only do this if the hostname is not already set
|
# Only do this if the hostname is not already set
|
||||||
if !comm.test("sudo hostname | grep '#{name}'")
|
if !comm.test("sudo hostname | grep --line-regexp '#{name}'")
|
||||||
comm.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network")
|
comm.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network")
|
||||||
comm.sudo("hostname #{name}")
|
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@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
||||||
|
|
Loading…
Reference in New Issue