Class: VagrantPlugins::AVF::SyncedFolder
- Inherits:
-
Object
- Object
- VagrantPlugins::AVF::SyncedFolder
- Defined in:
- lib/vagrant_provider_avf/synced_folder.rb
Constant Summary collapse
- SHARED_DIRECTORIES_ROOT =
"/run/avf-shares".freeze
Instance Method Summary collapse
- #cleanup(_machine, _opts) ⇒ Object
- #disable(machine, folders, _opts) ⇒ Object
- #enable(machine, folders, _opts) ⇒ Object
- #prepare(_machine, _folders, _opts) ⇒ Object
- #usable?(machine, raise_error = false) ⇒ Boolean
Instance Method Details
#cleanup(_machine, _opts) ⇒ Object
37 38 |
# File 'lib/vagrant_provider_avf/synced_folder.rb', line 37 def cleanup(_machine, _opts) end |
#disable(machine, folders, _opts) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/vagrant_provider_avf/synced_folder.rb', line 28 def disable(machine, folders, _opts) folders.each_value do |data| guest_path = Shellwords.escape(data[:guestpath]) machine.communicate.sudo("mountpoint -q #{guest_path} && umount #{guest_path} || true") end shared_root = Shellwords.escape(SHARED_DIRECTORIES_ROOT) machine.communicate.sudo("mountpoint -q #{shared_root} && umount #{shared_root} || true") end |
#enable(machine, folders, _opts) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/vagrant_provider_avf/synced_folder.rb', line 19 def enable(machine, folders, _opts) mount_shared_root(machine) folders.each do |id, data| mount_shared_directory(machine, id, data[:guestpath]) end rescue StandardError => error raise Errors::SyncedFolderMountFailed, error. end |
#prepare(_machine, _folders, _opts) ⇒ Object
16 17 |
# File 'lib/vagrant_provider_avf/synced_folder.rb', line 16 def prepare(_machine, _folders, _opts) end |
#usable?(machine, raise_error = false) ⇒ Boolean
8 9 10 11 12 13 14 |
# File 'lib/vagrant_provider_avf/synced_folder.rb', line 8 def usable?(machine, raise_error = false) return true if linux_avf_machine?(machine) return false unless raise_error raise Errors::SyncedFoldersUnavailable, "AVF shared directories currently support provider=:avf with guest=:linux only" end |