This commit adds a variety of fixes for SmartOS guest support: - Host name setting now works in the global zone and in non-global zones - NFS now works in the global zone and the non-global zone. - Tests are updated and moved to the (apparently) more modern style
27 lines
704 B
Ruby
27 lines
704 B
Ruby
module VagrantPlugins
|
|
module GuestSmartos
|
|
module Cap
|
|
class ChangeHostName
|
|
def self.change_host_name(machine, name)
|
|
sudo = machine.config.smartos.suexec_cmd
|
|
|
|
machine.communicate.tap do |comm|
|
|
comm.execute <<-EOH.sub(/^ */, '')
|
|
if hostname | grep '#{name}' ; then
|
|
exit 0
|
|
fi
|
|
|
|
if [ -d /usbkey ] && [ "$(zonename)" == "global" ] ; then
|
|
#{sudo} sed -i '' 's/hostname=.*/hostname=#{name}/' /usbkey/config
|
|
fi
|
|
|
|
#{sudo} echo '#{name}' > /etc/nodename
|
|
#{sudo} hostname #{name}
|
|
EOH
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|