vagrant-nfs_guest 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -8
- data/lib/vagrant-nfs_guest/action/mount_nfs.rb +39 -13
- data/lib/vagrant-nfs_guest/action/unmount_nfs.rb +1 -4
- data/lib/vagrant-nfs_guest/config.rb +3 -6
- data/lib/vagrant-nfs_guest/errors.rb +3 -0
- data/lib/vagrant-nfs_guest/plugin.rb +21 -25
- data/lib/vagrant-nfs_guest/providers/docker/cap/nfs_settings.rb +19 -0
- data/lib/vagrant-nfs_guest/providers/docker/plugin.rb +15 -0
- data/lib/vagrant-nfs_guest/providers/parallels/cap/nfs_settings.rb +17 -0
- data/lib/vagrant-nfs_guest/providers/parallels/plugin.rb +15 -0
- data/lib/vagrant-nfs_guest/{action/prepare_nfs_guest_settings.rb → providers/virtualbox/cap/nfs_settings.rb} +16 -49
- data/lib/vagrant-nfs_guest/providers/virtualbox/plugin.rb +15 -0
- data/lib/vagrant-nfs_guest/synced_folder.rb +32 -44
- data/lib/vagrant-nfs_guest/version.rb +1 -1
- data/templates/locales/en.yml +5 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d1379c8d93def3e1c8415422a423f262b400a4f
|
4
|
+
data.tar.gz: 1fa184114a1c5cc8dec18f4162a17f3264e82828
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c5f0fb3684ae66a003883d266db0bfa0b2f8764262a34d78dc9340a38e267ba02e873684b38bd764d12cc8e4332ed6660ca36ccb63f22f814aace9ff998779b
|
7
|
+
data.tar.gz: 5eaf6f74d023258a47e76f2ec58f37bee8fa796837dab2d80d72484b2479f27c55b7ba5a140e3c651371f255b5349de12e540a35f82f31ee8cb04a4e322ac5d8
|
data/README.md
CHANGED
@@ -2,14 +2,17 @@
|
|
2
2
|
|
3
3
|
## What's New?
|
4
4
|
|
5
|
-
-
|
6
|
-
-
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
11
|
-
-
|
12
|
-
-
|
5
|
+
- NEW: added untested support for Parallels and Docker providers (Please raise any issues if they don't work!).
|
6
|
+
- NEW: Redhat/CentOS guest support added.
|
7
|
+
- FIXED: suspend and resume with 'up' instead of 'resume' fixed.
|
8
|
+
- Supports Vagrant > 1.6.
|
9
|
+
- Handles actions ```up```, ```halt```, ```destroy```, ```suspend```, ```resume``` and ```package``` properly.
|
10
|
+
- Uses retryable() for host to guest communications allow more fault tolerance.
|
11
|
+
- Better error messages and handling.
|
12
|
+
- Re-organisation of modules and class to better match Vagrant proper.
|
13
|
+
- Simplified the plugin events binding.
|
14
|
+
- Will install the NFS daemon on the guest if the guest capability is supported (Ubuntu and Debian only at this stage).
|
15
|
+
- Supports BSD/OSX, and Linux based Hosts that support NFS mounting.
|
13
16
|
|
14
17
|
## Overview
|
15
18
|
|
@@ -11,26 +11,52 @@ module VagrantPlugins
|
|
11
11
|
def call(env)
|
12
12
|
@machine = env[:machine]
|
13
13
|
|
14
|
+
# because we're hooked into Vagrant::Action::Builtin::SyncedFolders and
|
15
|
+
# Vagrant::Action::Builtin::WaitForCommunicator we need to figure out
|
16
|
+
# if we're 'up'ing from 'poweroff' or 'up'ing from 'suspend'
|
17
|
+
# If 'poweroff' we get called twice once with state.id = 'poweroff' and
|
18
|
+
# again with state.id = 'running'. This toggle around @app.call() allows
|
19
|
+
# the second call to actually do the mount after the SyncFolder setup
|
20
|
+
# has completed properly. If 'running' well then we just do the mount
|
21
|
+
# as we're obvioulsy coming from a 'suspended' instance. Stupid bug.
|
22
|
+
if !env[:nfs_guest_first_state]
|
23
|
+
env[:nfs_guest_first_state] = @machine.state.id
|
24
|
+
end
|
25
|
+
|
26
|
+
@app.call(env)
|
27
|
+
|
28
|
+
# ... and also deal with 'reload' :weary:
|
29
|
+
if env[:nfs_guest_first_state] == :poweroff and env[:action_name] != :machine_action_reload
|
30
|
+
env[:nfs_guest_first_state] = @machine.state.id
|
31
|
+
return
|
32
|
+
end
|
33
|
+
|
14
34
|
if @machine.state.id == :running
|
35
|
+
if !@machine.provider.capability?(:nfs_settings)
|
36
|
+
raise SyncedFolderNFSGuest::Errors::ProviderNFSSettingsCapMissing
|
37
|
+
end
|
38
|
+
|
39
|
+
# grab the ips from the provider
|
40
|
+
host_ip, machine_ip = @machine.provider.capability(:nfs_settings)
|
15
41
|
|
16
|
-
raise Vagrant::Errors::NFSNoHostIP if !
|
17
|
-
raise Vagrant::Errors::NFSNoGuestIP if !
|
42
|
+
raise Vagrant::Errors::NFSNoHostIP if !host_ip
|
43
|
+
raise Vagrant::Errors::NFSNoGuestIP if !machine_ip
|
18
44
|
|
19
|
-
machine_ip = env[:nfs_guest_machine_ip]
|
20
45
|
machine_ip = [machine_ip] if !machine_ip.is_a?(Array)
|
21
46
|
|
22
|
-
|
23
|
-
|
24
|
-
|
47
|
+
if @machine.config.nfs_guest.verify_installed
|
48
|
+
if @machine.guest.capability?(:nfs_server_installed)
|
49
|
+
installed = @machine.guest.capability(:nfs_server_installed)
|
50
|
+
if installed
|
51
|
+
# Mount guest NFS folders
|
52
|
+
@machine.ui.info(I18n.t("vagrant_nfs_guest.actions.vm.nfs.mounting"))
|
53
|
+
folders = @machine.config.vm.synced_folders
|
25
54
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
55
|
+
@machine.env.host.capability(:nfs_mount, @machine.ui, @machine.id, machine_ip, folders)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
30
59
|
end
|
31
|
-
|
32
|
-
@app.call(env)
|
33
|
-
|
34
60
|
end
|
35
61
|
end
|
36
62
|
end
|
@@ -16,10 +16,7 @@ module VagrantPlugins
|
|
16
16
|
@machine.ui.info(I18n.t("vagrant_nfs_guest.actions.vm.nfs.unmounting"))
|
17
17
|
folders = @machine.config.vm.synced_folders
|
18
18
|
|
19
|
-
@machine.env.host.capability(
|
20
|
-
:nfs_unmount,
|
21
|
-
@machine.ui, folders
|
22
|
-
)
|
19
|
+
@machine.env.host.capability(:nfs_unmount, @machine.ui, folders)
|
23
20
|
end
|
24
21
|
|
25
22
|
@app.call(env)
|
@@ -6,8 +6,7 @@ module VagrantPlugins
|
|
6
6
|
attr_accessor :functional
|
7
7
|
attr_accessor :map_uid
|
8
8
|
attr_accessor :map_gid
|
9
|
-
attr_accessor :
|
10
|
-
attr_accessor :guest_ip
|
9
|
+
attr_accessor :verify_installed
|
11
10
|
|
12
11
|
def initialize
|
13
12
|
super
|
@@ -15,16 +14,14 @@ module VagrantPlugins
|
|
15
14
|
@functional = UNSET_VALUE
|
16
15
|
@map_uid = UNSET_VALUE
|
17
16
|
@map_gid = UNSET_VALUE
|
18
|
-
@
|
19
|
-
@guest_ip = UNSET_VALUE
|
17
|
+
@verify_installed = UNSET_VALUE
|
20
18
|
end
|
21
19
|
|
22
20
|
def finalize!
|
23
21
|
@functional = true if @functional == UNSET_VALUE
|
24
22
|
@map_uid = nil if @map_uid == UNSET_VALUE
|
25
23
|
@map_gid = nil if @map_gid == UNSET_VALUE
|
26
|
-
@
|
27
|
-
@guest_ip = nil if @guest_ip == UNSET_VALUE
|
24
|
+
@verify_installed = true if @verify_installed == UNSET_VALUE
|
28
25
|
end
|
29
26
|
|
30
27
|
def to_s
|
@@ -16,6 +16,9 @@ require_relative "guests/redhat/plugin"
|
|
16
16
|
require_relative "guests/ubuntu/plugin"
|
17
17
|
require_relative "hosts/bsd/plugin"
|
18
18
|
require_relative "hosts/linux/plugin"
|
19
|
+
require_relative "providers/virtualbox/plugin"
|
20
|
+
require_relative "providers/parallels/plugin"
|
21
|
+
require_relative "providers/docker/plugin"
|
19
22
|
|
20
23
|
module VagrantPlugins
|
21
24
|
module SyncedFolderNFSGuest
|
@@ -35,36 +38,32 @@ module VagrantPlugins
|
|
35
38
|
Config
|
36
39
|
end
|
37
40
|
|
38
|
-
synced_folder(:nfs_guest,
|
41
|
+
synced_folder(:nfs_guest, 5) do
|
39
42
|
require_relative "synced_folder"
|
40
43
|
SyncedFolder
|
41
44
|
end
|
42
45
|
|
43
46
|
action_hook(:nfs_guest, :machine_action_up) do |hook|
|
44
|
-
require_relative "action/
|
45
|
-
hook.
|
46
|
-
|
47
|
-
Action::
|
47
|
+
require_relative "action/mount_nfs"
|
48
|
+
hook.before(
|
49
|
+
Vagrant::Action::Builtin::WaitForCommunicator,
|
50
|
+
Action::MountNFS
|
48
51
|
)
|
49
|
-
end
|
50
|
-
|
51
|
-
action_hook(:nfs_guest, :machine_action_reload) do |hook|
|
52
|
-
require_relative "action/prepare_nfs_guest_settings"
|
53
52
|
hook.before(
|
54
|
-
|
55
|
-
Action::
|
53
|
+
Vagrant::Action::Builtin::SyncedFolders,
|
54
|
+
Action::MountNFS
|
56
55
|
)
|
57
56
|
end
|
58
57
|
|
58
|
+
action_hook(:nfs_guest, :machine_action_suspend) do |hook|
|
59
|
+
require_relative "action/unmount_nfs"
|
60
|
+
hook.prepend(Action::UnmountNFS)
|
61
|
+
end
|
62
|
+
|
59
63
|
action_hook(:nfs_guest, :machine_action_resume) do |hook|
|
60
64
|
require_relative "action/mount_nfs"
|
61
|
-
require_relative "action/prepare_nfs_guest_settings"
|
62
65
|
hook.after(
|
63
|
-
|
64
|
-
Action::PrepareNFSGuestSettings
|
65
|
-
)
|
66
|
-
hook.after(
|
67
|
-
Action::PrepareNFSGuestSettings,
|
66
|
+
Vagrant::Action::Builtin::WaitForCommunicator,
|
68
67
|
Action::MountNFS
|
69
68
|
)
|
70
69
|
end
|
@@ -79,17 +78,14 @@ module VagrantPlugins
|
|
79
78
|
|
80
79
|
action_hook(:nfs_guest, :machine_action_reload) do |hook|
|
81
80
|
require_relative "action/unmount_nfs"
|
81
|
+
require_relative "action/mount_nfs"
|
82
82
|
hook.before(
|
83
83
|
Vagrant::Action::Builtin::GracefulHalt,
|
84
84
|
Action::UnmountNFS
|
85
85
|
)
|
86
|
-
end
|
87
|
-
|
88
|
-
action_hook(:nfs_guest, :machine_action_package) do |hook|
|
89
|
-
require_relative "action/unmount_nfs"
|
90
86
|
hook.before(
|
91
|
-
Vagrant::Action::Builtin::
|
92
|
-
Action::
|
87
|
+
Vagrant::Action::Builtin::SyncedFolders,
|
88
|
+
Action::MountNFS
|
93
89
|
)
|
94
90
|
end
|
95
91
|
|
@@ -101,10 +97,10 @@ module VagrantPlugins
|
|
101
97
|
)
|
102
98
|
end
|
103
99
|
|
104
|
-
action_hook(:nfs_guest, :
|
100
|
+
action_hook(:nfs_guest, :machine_action_package) do |hook|
|
105
101
|
require_relative "action/unmount_nfs"
|
106
102
|
hook.before(
|
107
|
-
|
103
|
+
Vagrant::Action::Builtin::GracefulHalt,
|
108
104
|
Action::UnmountNFS
|
109
105
|
)
|
110
106
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module SyncedFolderNFSGuest
|
3
|
+
module ProviderDocker
|
4
|
+
module Cap
|
5
|
+
|
6
|
+
def self.nfs_settings(machine)
|
7
|
+
provider = machine.provider
|
8
|
+
|
9
|
+
host_ip = provider.driver.docker_bridge_ip
|
10
|
+
machine_ip = provider.ssh_info[:host]
|
11
|
+
|
12
|
+
raise Vagrant::Errors::NFSNoHostonlyNetwork if !host_ip || !machine_ip
|
13
|
+
|
14
|
+
return host_ip, machine_ip
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module SyncedFolderNFSGuest
|
5
|
+
class Plugin < Vagrant.plugin("2")
|
6
|
+
name "docker-provider"
|
7
|
+
description "Docker provider"
|
8
|
+
|
9
|
+
provider_capability(:docker, :nfs_settings) do
|
10
|
+
require_relative "cap/nfs_settings"
|
11
|
+
ProviderDocker::Cap
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module SyncedFolderNFSGuest
|
3
|
+
module ProviderParallels
|
4
|
+
module Cap
|
5
|
+
|
6
|
+
def self.nfs_settings(machine)
|
7
|
+
host_ip = @machine.provider.driver.read_shared_interface[:ip]
|
8
|
+
machine_ip = @machine.provider.driver.read_guest_ip
|
9
|
+
|
10
|
+
raise Vagrant::Errors::NFSNoHostonlyNetwork if !host_ip || !machine_ip
|
11
|
+
|
12
|
+
return host_ip, machine_ip
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module SyncedFolderNFSGuest
|
5
|
+
class Plugin < Vagrant.plugin("2")
|
6
|
+
name "vagrant-parallels"
|
7
|
+
description "Parallels provider"
|
8
|
+
|
9
|
+
provider_capability(:parallels, :nfs_settings) do
|
10
|
+
require_relative "cap/nfs_settings"
|
11
|
+
ProviderParallels::Cap
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,60 +1,25 @@
|
|
1
1
|
module VagrantPlugins
|
2
2
|
module SyncedFolderNFSGuest
|
3
|
-
module
|
4
|
-
|
5
|
-
include Vagrant::Util::Retryable
|
3
|
+
module ProviderVirtualBox
|
4
|
+
module Cap
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def initialize(app,env)
|
12
|
-
@app = app
|
13
|
-
@logger = Log4r::Logger.new("vagrant-nfs_guest::action::prepare_nfs_guest_settings")
|
14
|
-
end
|
15
|
-
|
16
|
-
def call(env)
|
17
|
-
@machine = env[:machine]
|
18
|
-
|
19
|
-
if using_nfs?
|
20
|
-
@logger.info("Using NFS_guest, preparing NFS settings by reading host IP and machine IP")
|
21
|
-
add_ips_to_env!(env)
|
22
|
-
end
|
23
|
-
|
24
|
-
@app.call(env)
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
# We're using NFS if we have any synced folder with NFS configured. If
|
29
|
-
# we are not using NFS we don't need to do the extra work to
|
30
|
-
# populate these fields in the environment.
|
31
|
-
def using_nfs?
|
32
|
-
@machine.config.vm.synced_folders.any? { |_, opts| opts[:type] == :nfs_guest }
|
33
|
-
end
|
34
|
-
|
35
|
-
# Extracts the proper host and guest IPs for NFS mounts and stores them
|
36
|
-
# in the environment for the SyncedFolder action to use them in
|
37
|
-
# mounting.
|
38
|
-
#
|
39
|
-
# The ! indicates that this method modifies its argument.
|
40
|
-
def add_ips_to_env!(env)
|
41
|
-
adapter, host_ip = find_host_only_adapter
|
42
|
-
machine_ip = read_static_machine_ips || read_dynamic_machine_ip(adapter)
|
6
|
+
def self.nfs_settings(machine)
|
7
|
+
adapter, host_ip = self.find_host_only_adapter(machine)
|
8
|
+
machine_ip = self.read_static_machine_ips(machine) || self.read_dynamic_machine_ip(machine, adapter)
|
43
9
|
|
44
10
|
raise Vagrant::Errors::NFSNoHostonlyNetwork if !host_ip || !machine_ip
|
45
11
|
|
46
|
-
|
47
|
-
env[:nfs_guest_machine_ip] = machine_ip
|
12
|
+
return host_ip, machine_ip
|
48
13
|
end
|
49
14
|
|
50
15
|
# Finds first host only network adapter and returns its adapter number
|
51
16
|
# and IP address
|
52
17
|
#
|
53
18
|
# @return [Integer, String] adapter number, ip address of found host-only adapter
|
54
|
-
def find_host_only_adapter
|
55
|
-
|
19
|
+
def self.find_host_only_adapter(machine)
|
20
|
+
machine.provider.driver.read_network_interfaces.each do |adapter, opts|
|
56
21
|
if opts[:type] == :hostonly
|
57
|
-
|
22
|
+
machine.provider.driver.read_host_only_interfaces.each do |interface|
|
58
23
|
if interface[:name] == opts[:hostonly]
|
59
24
|
return adapter, interface[:ip]
|
60
25
|
end
|
@@ -69,10 +34,10 @@ module VagrantPlugins
|
|
69
34
|
# given to host only adapters in the Vagrantfile
|
70
35
|
#
|
71
36
|
# @return [Array]<String> Configured static IPs
|
72
|
-
def read_static_machine_ips
|
37
|
+
def self.read_static_machine_ips(machine)
|
73
38
|
ips = []
|
74
|
-
|
75
|
-
if type == :private_network && options[:ip].is_a?(String)
|
39
|
+
machine.config.vm.networks.each do |type, options|
|
40
|
+
if type == :private_network && options[:type] != :dhcp && options[:ip].is_a?(String)
|
76
41
|
ips << options[:ip]
|
77
42
|
end
|
78
43
|
end
|
@@ -92,7 +57,9 @@ module VagrantPlugins
|
|
92
57
|
#
|
93
58
|
# @param [Integer] adapter number to read IP for
|
94
59
|
# @return [String] ip address of adapter
|
95
|
-
def read_dynamic_machine_ip(adapter)
|
60
|
+
def self.read_dynamic_machine_ip(machine, adapter)
|
61
|
+
return nil unless adapter
|
62
|
+
|
96
63
|
# vbox guest properties are 0-indexed, while showvminfo network
|
97
64
|
# interfaces are 1-indexed. go figure.
|
98
65
|
guestproperty_adapter = adapter - 1
|
@@ -101,7 +68,7 @@ module VagrantPlugins
|
|
101
68
|
# retry thresholds are relatively high since we might need to wait
|
102
69
|
# for DHCP, but even static IPs can take a second or two to appear.
|
103
70
|
retryable(retry_options.merge(on: Vagrant::Errors::VirtualBoxGuestPropertyNotFound)) do
|
104
|
-
|
71
|
+
machine.provider.driver.read_guest_ip(guestproperty_adapter)
|
105
72
|
end
|
106
73
|
rescue Vagrant::Errors::VirtualBoxGuestPropertyNotFound
|
107
74
|
# this error is more specific with a better error message directing
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "vagrant"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module SyncedFolderNFSGuest
|
5
|
+
class Plugin < Vagrant.plugin("2")
|
6
|
+
name "VirtualBox provider"
|
7
|
+
description "VirtualBox provider"
|
8
|
+
|
9
|
+
provider_capability(:virtualbox, :nfs_settings) do
|
10
|
+
require_relative "cap/nfs_settings"
|
11
|
+
ProviderVirtualBox::Cap
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -3,6 +3,13 @@ require 'zlib'
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module SyncedFolderNFSGuest
|
5
5
|
class SyncedFolder < Vagrant.plugin("2", :synced_folder)
|
6
|
+
|
7
|
+
def initialize(*args)
|
8
|
+
super
|
9
|
+
|
10
|
+
@logger = Log4r::Logger.new("vagrant::synced_folders::nfs_guest")
|
11
|
+
end
|
12
|
+
|
6
13
|
def usable?(machine, raise_error=false)
|
7
14
|
# If the machine explicitly said NFS is not supported, then
|
8
15
|
# it isn't supported.
|
@@ -15,12 +22,33 @@ module VagrantPlugins
|
|
15
22
|
end
|
16
23
|
|
17
24
|
def enable(machine, folders, nfsopts)
|
18
|
-
|
19
|
-
|
25
|
+
if !machine.provider.capability?(:nfs_settings)
|
26
|
+
raise Errors::ProviderNFSSettingsCapMissing
|
27
|
+
end
|
20
28
|
|
21
|
-
|
29
|
+
# I've abstracted this out to a plugin provided capability per
|
30
|
+
# provider as it's impossible to resume a VM because the
|
31
|
+
# PrepareNFSSettings action NEVER is trigger on a resume because
|
32
|
+
# the host is exporting so therefore it's assumed to always be there.
|
33
|
+
# Easier to maintain and add new providers this way.
|
34
|
+
host_ip, machine_ip = machine.provider.capability(:nfs_settings)
|
22
35
|
machine_ip = [machine_ip] if !machine_ip.is_a?(Array)
|
23
36
|
|
37
|
+
raise Vagrant::Errors::NFSNoHostIP if !host_ip
|
38
|
+
raise Vagrant::Errors::NFSNoGuestIP if !machine_ip
|
39
|
+
|
40
|
+
if machine.config.nfs_guest.verify_installed
|
41
|
+
if machine.guest.capability?(:nfs_server_installed)
|
42
|
+
installed = machine.guest.capability(:nfs_server_installed)
|
43
|
+
if !installed
|
44
|
+
can_install = machine.guest.capability?(:nfs_server_install)
|
45
|
+
raise Errors::NFSServerNotInstalledInGuest if !can_install
|
46
|
+
machine.ui.info I18n.t("vagrant_nfs_guest.guests.linux.nfs_server_installing")
|
47
|
+
machine.guest.capability(:nfs_server_install)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
24
52
|
# Prepare the folder, this means setting up various options
|
25
53
|
# and such on the folder itself.
|
26
54
|
folders.each { |id, opts| prepare_folder(machine, opts) }
|
@@ -32,14 +60,7 @@ module VagrantPlugins
|
|
32
60
|
end
|
33
61
|
|
34
62
|
machine.ui.info I18n.t("vagrant_nfs_guest.actions.vm.nfs.exporting")
|
35
|
-
machine.guest.capability(
|
36
|
-
:nfs_export, nfsopts[:nfs_guest_host_ip], mount_folders)
|
37
|
-
|
38
|
-
machine.ui.info I18n.t("vagrant_nfs_guest.actions.vm.nfs.mounting")
|
39
|
-
machine.env.host.capability(
|
40
|
-
:nfs_mount,
|
41
|
-
machine.ui, machine.id, machine_ip, mount_folders
|
42
|
-
)
|
63
|
+
machine.guest.capability(:nfs_export, host_ip, mount_folders)
|
43
64
|
end
|
44
65
|
|
45
66
|
protected
|
@@ -69,39 +90,6 @@ module VagrantPlugins
|
|
69
90
|
# (value == :auto)
|
70
91
|
return machine.guest.capability("read_#{perm}".to_sym)
|
71
92
|
end
|
72
|
-
|
73
|
-
private
|
74
|
-
|
75
|
-
def verify_nfs_installation(machine)
|
76
|
-
if !machine.guest.capability(:nfs_server_installed)
|
77
|
-
raise Errors::NFSServerNotInstalledInGuest unless machine.guest.capability?(:nfs_server_install)
|
78
|
-
|
79
|
-
machine.ui.info I18n.t("vagrant_nfs_guest.guests.linux.nfs_server_installing")
|
80
|
-
machine.guest.capability(:nfs_server_install)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def verify_nfs_options(machine, nfsopts = {})
|
85
|
-
if !nfsopts[:nfs_guest_host_ip]
|
86
|
-
if machine.config.nfs_guest.host_ip
|
87
|
-
nfsopts[:nfs_guest_host_ip] = machine.config.nfs_guest.host_ip
|
88
|
-
end
|
89
|
-
|
90
|
-
raise Vagrant::Errors::NFSNoHostIP if !nfsopts[:nfs_guest_host_ip]
|
91
|
-
end
|
92
|
-
|
93
|
-
if !nfsopts[:nfs_guest_machine_ip]
|
94
|
-
if machine.config.nfs_guest.guest_ip
|
95
|
-
nfsopts[:nfs_guest_machine_ip] = machine.config.nfs_guest.guest_ip
|
96
|
-
end
|
97
|
-
|
98
|
-
raise Vagrant::Errors::NFSNoGuestIP if !nfsopts[:nfs_guest_machine_ip]
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def extract_guest_ip(folder)
|
103
|
-
folder[:guest_ip] || folder[:machine_ip]
|
104
|
-
end
|
105
93
|
end
|
106
94
|
end
|
107
95
|
end
|
data/templates/locales/en.yml
CHANGED
@@ -52,3 +52,8 @@ en:
|
|
52
52
|
|
53
53
|
nfs_guest_clean: |-
|
54
54
|
Something failed while cleaning up NFS shared folders on the guest.
|
55
|
+
|
56
|
+
provider_missing_nfs_setting_cap: |-
|
57
|
+
Missing provider support in vagrant-nfs_guest plugin for retrieving host and guest IPs.
|
58
|
+
|
59
|
+
Currently only Virtualbox provider is supported.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-nfs_guest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan Garfield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,7 +55,6 @@ files:
|
|
55
55
|
- example_box/vagrant_share/.keep
|
56
56
|
- lib/vagrant-nfs_guest.rb
|
57
57
|
- lib/vagrant-nfs_guest/action/mount_nfs.rb
|
58
|
-
- lib/vagrant-nfs_guest/action/prepare_nfs_guest_settings.rb
|
59
58
|
- lib/vagrant-nfs_guest/action/unmount_nfs.rb
|
60
59
|
- lib/vagrant-nfs_guest/config.rb
|
61
60
|
- lib/vagrant-nfs_guest/errors.rb
|
@@ -75,6 +74,12 @@ files:
|
|
75
74
|
- lib/vagrant-nfs_guest/hosts/linux/cap/unmount_nfs.rb
|
76
75
|
- lib/vagrant-nfs_guest/hosts/linux/plugin.rb
|
77
76
|
- lib/vagrant-nfs_guest/plugin.rb
|
77
|
+
- lib/vagrant-nfs_guest/providers/docker/cap/nfs_settings.rb
|
78
|
+
- lib/vagrant-nfs_guest/providers/docker/plugin.rb
|
79
|
+
- lib/vagrant-nfs_guest/providers/parallels/cap/nfs_settings.rb
|
80
|
+
- lib/vagrant-nfs_guest/providers/parallels/plugin.rb
|
81
|
+
- lib/vagrant-nfs_guest/providers/virtualbox/cap/nfs_settings.rb
|
82
|
+
- lib/vagrant-nfs_guest/providers/virtualbox/plugin.rb
|
78
83
|
- lib/vagrant-nfs_guest/synced_folder.rb
|
79
84
|
- lib/vagrant-nfs_guest/version.rb
|
80
85
|
- templates/locales/en.yml
|