2013-04-30 22:07:34 +00:00
|
|
|
module VagrantPlugins
|
2013-05-02 02:02:00 +00:00
|
|
|
module GuestOmniOS
|
2013-04-30 22:07:34 +00:00
|
|
|
module Cap
|
|
|
|
class ChangeHostName
|
|
|
|
def self.change_host_name(machine, name)
|
|
|
|
su_cmd = machine.config.solaris.suexec_cmd
|
|
|
|
|
|
|
|
# Only do this if the hostname is not already set
|
|
|
|
if !machine.communicate.test("#{su_cmd} hostname | grep '#{name}'")
|
|
|
|
machine.communicate.execute("#{su_cmd} sh -c \"echo '#{name}' > /etc/nodename\"")
|
|
|
|
machine.communicate.execute("#{su_cmd} hostname #{name}")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|