From 43f732b32dd03a98043f379643a3d2ae251e3f90 Mon Sep 17 00:00:00 2001 From: Mark Harrison Date: Thu, 20 Mar 2014 17:00:34 -0400 Subject: [PATCH] Add mount_nfs_folder capability to omnios guests Refs issue #3280 --- plugins/guests/omnios/cap/mount_nfs_folder.rb | 15 +++++++++++++++ plugins/guests/omnios/plugin.rb | 5 +++++ 2 files changed, 20 insertions(+) create mode 100644 plugins/guests/omnios/cap/mount_nfs_folder.rb diff --git a/plugins/guests/omnios/cap/mount_nfs_folder.rb b/plugins/guests/omnios/cap/mount_nfs_folder.rb new file mode 100644 index 000000000..250f77992 --- /dev/null +++ b/plugins/guests/omnios/cap/mount_nfs_folder.rb @@ -0,0 +1,15 @@ +module VagrantPlugins + module GuestOmniOS + module Cap + class MountNFSFolder + def self.mount_nfs_folder(machine, ip, folders) + su_cmd = machine.config.solaris.suexec_cmd + folders.each do |name, opts| + machine.communicate.execute("#{su_cmd} mkdir -p #{opts[:guestpath]}") + machine.communicate.execute("#{su_cmd} /sbin/mount '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'") + end + end + end + end + end +end diff --git a/plugins/guests/omnios/plugin.rb b/plugins/guests/omnios/plugin.rb index 929132cf8..9193f0db8 100644 --- a/plugins/guests/omnios/plugin.rb +++ b/plugins/guests/omnios/plugin.rb @@ -15,6 +15,11 @@ module VagrantPlugins require_relative "cap/change_host_name" Cap::ChangeHostName end + + guest_capability("omnios", "mount_nfs_folder") do + require_relative "cap/mount_nfs_folder" + Cap::MountNFSFolder + end end end end