James Nugent b0b9d044b5 guests/smartos: Add/fix various guest capabilities
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
2017-06-16 17:00:50 -04:00

29 lines
882 B
Ruby

module VagrantPlugins
module GuestSmartos
module Cap
class MountNFS
def self.mount_nfs_folder(machine, ip, folders)
sudo = machine.config.smartos.suexec_cmd
folders.each do |name, opts|
machine.communicate.tap do |comm|
nfsDescription = "#{ip}:#{opts[:hostpath]}:#{opts[:guestpath]}"
comm.execute <<-EOH.sub(/^ */, '')
if [ -d /usbkey ] && [ "$(zonename)" == "global" ] ; then
#{sudo} mkdir -p /usbkey/config.inc
printf '#{nfsDescription}\\n' | #{sudo} tee -a /usbkey/config.inc/nfs_mounts
fi
#{sudo} mkdir -p #{opts[:guestpath]}
#{sudo} /usr/sbin/mount -F nfs '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'
EOH
end
end
end
end
end
end
end