Merge pull request #6867 from jlduran/freebsd-hostname-string

FreeBSD: Use quotes around hostname in rc.conf
This commit is contained in:
Seth Vargo 2016-02-03 09:59:11 -05:00
commit e7ff8df256
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ module VagrantPlugins
class ChangeHostName class ChangeHostName
def self.change_host_name(machine, name) def self.change_host_name(machine, name)
if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'", {shell: "sh"}) if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'", {shell: "sh"})
machine.communicate.sudo("sed -i '' 's/^hostname=.*$/hostname=#{name}/' /etc/rc.conf", {shell: "sh"}) machine.communicate.sudo("sed -i '' 's/^hostname=.*$/hostname=\"#{name}\"/' /etc/rc.conf", {shell: "sh"})
machine.communicate.sudo("hostname #{name}", {shell: "sh"}) machine.communicate.sudo("hostname #{name}", {shell: "sh"})
end end
end end