vaguerent/plugins/guests/photon/cap/change_host_name.rb
Fabio Rapposelli 21db4470a0 Add Guest support for VMware Photon.
Signed-off-by: Fabio Rapposelli <fabio@vmware.com>
2015-04-20 10:13:21 -07:00

16 lines
376 B
Ruby

module VagrantPlugins
module GuestPhoton
module Cap
class ChangeHostName
def self.change_host_name(machine, name)
machine.communicate.tap do |comm|
unless comm.test("sudo hostname --fqdn | grep '#{name}'")
comm.sudo("hostname #{name.split('.')[0]}")
end
end
end
end
end
end
end