2014-03-06 08:18:29 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module GuestSmartos
|
|
|
|
module Cap
|
|
|
|
class ChangeHostName
|
|
|
|
def self.change_host_name(machine, name)
|
|
|
|
su_cmd = machine.config.smartos.suexec_cmd
|
|
|
|
|
|
|
|
# Only do this if the hostname is not already set
|
2014-03-11 01:52:20 +00:00
|
|
|
if !machine.communicate.test("hostname | grep '#{name}'")
|
2014-03-06 08:18:29 +00:00
|
|
|
machine.communicate.execute("#{su_cmd} sh -c \"echo '#{name}' > /etc/nodename\"")
|
|
|
|
machine.communicate.execute("#{su_cmd} hostname #{name}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|