vagrant-nfs_guest 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile +0 -3
- data/README.md +18 -11
- data/example_box/Vagrantfile +123 -0
- data/example_box/vagrant_share/.keep +0 -0
- data/lib/vagrant-nfs_guest/action/mount_nfs.rb +0 -1
- data/lib/vagrant-nfs_guest/errors.rb +11 -0
- data/lib/vagrant-nfs_guest/guests/linux/cap/nfs_export.rb +46 -24
- data/lib/vagrant-nfs_guest/guests/ubuntu/cap/nfs_server.rb +18 -0
- data/lib/vagrant-nfs_guest/hosts/bsd/cap/mount_nfs.rb +21 -21
- data/lib/vagrant-nfs_guest/hosts/bsd/cap/unmount_nfs.rb +21 -21
- data/lib/vagrant-nfs_guest/plugin.rb +25 -0
- data/lib/vagrant-nfs_guest/synced_folder.rb +10 -2
- data/lib/vagrant-nfs_guest/version.rb +1 -1
- data/lib/vagrant-nfs_guest.rb +0 -1
- data/templates/locales/en.yml +7 -0
- metadata +5 -3
- data/lib/vagrant-nfs_guest/hosts/bsd/plugin.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c362cefceea2b475c4b63eda88bb57e7c4197e7
|
4
|
+
data.tar.gz: c1cb2d3eadd42cdd4c6a1aad1a34939963e333eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 227d93bd2efd6be64ed95ec9eac1dbbeee06a02164b08ffc846cfc25faba334f37e254b1437012cd37c9d632b22a02446da39b1e188b3d53b06fbe6c268ebd01
|
7
|
+
data.tar.gz: 514f46fd8dec9dcf515d73d241d42757e7e96fb3b0cc93fa3ae23818f14305582da4ae100a4fa12e8617c504b3a6211bb0c39d8b157ac5d07d9b11a1a1c46ad5
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
## What's New?
|
4
4
|
|
5
5
|
- Supports Vagrant 1.6!
|
6
|
-
- Handles actions
|
6
|
+
- Handles actions ```up```, ```halt```, ```destroy```, ```suspend```, ```resume``` and ```package``` properly
|
7
7
|
- Uses retryable() for host to guest communications allow more fault tolerance
|
8
8
|
- Better error messages and handling
|
9
9
|
- Re-organisation of modules and class to better match Vagrant proper
|
@@ -17,24 +17,31 @@ Basically it's just the usual NFS synced folders in Vagrant but the roles are re
|
|
17
17
|
|
18
18
|
## Installation
|
19
19
|
|
20
|
-
|
20
|
+
vagrant plugin install vagrant-nfs_guest
|
21
21
|
|
22
|
-
|
22
|
+
## Install from sources
|
23
23
|
|
24
|
-
|
24
|
+
git clone https://github.com/Learnosity/vagrant-nfs_guest.git
|
25
|
+
cd vagrant-nfs_guest
|
26
|
+
bundle install
|
27
|
+
bundle exec rake build
|
28
|
+
vagrant plugin install pkg/vagrant-nfs_guest-VERSION.gem
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
Or install it yourself as:
|
30
|
+
## Usage
|
29
31
|
|
30
|
-
|
32
|
+
To enable for example put similar in the Vagrantfile:
|
31
33
|
|
32
|
-
|
34
|
+
config.vm.synced_folder 'srv', '/srv', type: 'nfs_guest'
|
33
35
|
|
34
|
-
|
36
|
+
## Building
|
35
37
|
|
36
|
-
|
38
|
+
We use 'chruby' to allow a virtual ruby environment for developement. The 'bundle' gem is needed to build and run
|
37
39
|
|
40
|
+
git clone https://github.com/Learnosity/vagrant-nfs_guest.git
|
41
|
+
cd vagrant-nfs_guest
|
42
|
+
bundle install
|
43
|
+
bundle exec vagrant
|
44
|
+
|
38
45
|
## Contributing
|
39
46
|
|
40
47
|
1. Fork it
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
+
VAGRANTFILE_API_VERSION = "2"
|
6
|
+
|
7
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
8
|
+
# All Vagrant configuration is done here. The most common configuration
|
9
|
+
# options are documented and commented below. For a complete reference,
|
10
|
+
# please see the online documentation at vagrantup.com.
|
11
|
+
|
12
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
13
|
+
config.vm.box = "hashicorp/precise64"
|
14
|
+
|
15
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
16
|
+
# doesn't already exist on the user's system.
|
17
|
+
#config.vm.box_url = ""
|
18
|
+
|
19
|
+
# Create a forwarded port mapping which allows access to a specific port
|
20
|
+
# within the machine from a port on the host machine. In the example below,
|
21
|
+
# accessing "localhost:8080" will access port 80 on the guest machine.
|
22
|
+
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
23
|
+
|
24
|
+
# Create a private network, which allows host-only access to the machine
|
25
|
+
# using a specific IP.
|
26
|
+
config.vm.network "private_network", ip: "192.168.55.10"
|
27
|
+
|
28
|
+
# Create a public network, which generally matched to bridged network.
|
29
|
+
# Bridged networks make the machine appear as another physical device on
|
30
|
+
# your network.
|
31
|
+
# config.vm.network "public_network"
|
32
|
+
|
33
|
+
# If true, then any SSH connections made will enable agent forwarding.
|
34
|
+
# Default value: false
|
35
|
+
# config.ssh.forward_agent = true
|
36
|
+
|
37
|
+
# Share an additional folder to the guest VM. The first argument is
|
38
|
+
# the path on the host to the actual folder. The second argument is
|
39
|
+
# the path on the guest to mount the folder. And the optional third
|
40
|
+
# argument is a set of non-required options.
|
41
|
+
# config.vm.synced_folder "../data", "/vagrant_data"
|
42
|
+
config.vm.synced_folder '.', '/vagrant', disabled: true
|
43
|
+
config.vm.synced_folder './vagrant_share', '/vagrant', type: 'nfs_guest'
|
44
|
+
|
45
|
+
# Provider-specific configuration so you can fine-tune various
|
46
|
+
# backing providers for Vagrant. These expose provider-specific options.
|
47
|
+
# Example for VirtualBox:
|
48
|
+
#
|
49
|
+
# config.vm.provider "virtualbox" do |vb|
|
50
|
+
# # Don't boot with headless mode
|
51
|
+
# vb.gui = true
|
52
|
+
#
|
53
|
+
# # Use VBoxManage to customize the VM. For example to change memory:
|
54
|
+
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# View the documentation for the provider you're using for more
|
58
|
+
# information on available options.
|
59
|
+
|
60
|
+
# Enable provisioning with CFEngine. CFEngine Community packages are
|
61
|
+
# automatically installed. For example, configure the host as a
|
62
|
+
# policy server and optionally a policy file to run:
|
63
|
+
#
|
64
|
+
# config.vm.provision "cfengine" do |cf|
|
65
|
+
# cf.am_policy_hub = true
|
66
|
+
# # cf.run_file = "motd.cf"
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# You can also configure and bootstrap a client to an existing
|
70
|
+
# policy server:
|
71
|
+
#
|
72
|
+
# config.vm.provision "cfengine" do |cf|
|
73
|
+
# cf.policy_server_address = "10.0.2.15"
|
74
|
+
# end
|
75
|
+
|
76
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
77
|
+
# are contained in a directory path relative to this Vagrantfile.
|
78
|
+
# You will need to create the manifests directory and a manifest in
|
79
|
+
# the file default.pp in the manifests_path directory.
|
80
|
+
#
|
81
|
+
# config.vm.provision "puppet" do |puppet|
|
82
|
+
# puppet.manifests_path = "manifests"
|
83
|
+
# puppet.manifest_file = "site.pp"
|
84
|
+
# end
|
85
|
+
|
86
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
87
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
88
|
+
# some recipes and/or roles.
|
89
|
+
#
|
90
|
+
# config.vm.provision "chef_solo" do |chef|
|
91
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
92
|
+
# chef.roles_path = "../my-recipes/roles"
|
93
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
94
|
+
# chef.add_recipe "mysql"
|
95
|
+
# chef.add_role "web"
|
96
|
+
#
|
97
|
+
# # You may also specify custom JSON attributes:
|
98
|
+
# chef.json = { mysql_password: "foo" }
|
99
|
+
# end
|
100
|
+
|
101
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
102
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
103
|
+
#
|
104
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
105
|
+
# ORGNAME in the URL and validation key.
|
106
|
+
#
|
107
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
108
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
109
|
+
# validation key to validation.pem.
|
110
|
+
#
|
111
|
+
# config.vm.provision "chef_client" do |chef|
|
112
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
113
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
114
|
+
# end
|
115
|
+
#
|
116
|
+
# If you're using the Opscode platform, your validator client is
|
117
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
118
|
+
#
|
119
|
+
# If you have your own Chef Server, the default validation client name is
|
120
|
+
# chef-validator, unless you changed the configuration.
|
121
|
+
#
|
122
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
123
|
+
end
|
File without changes
|
@@ -9,9 +9,20 @@ module VagrantPlugins
|
|
9
9
|
end
|
10
10
|
|
11
11
|
class GuestNFSError < Error
|
12
|
+
error_key(:nfs_server_missing)
|
12
13
|
error_key(:nfs_start_failed)
|
13
14
|
error_key(:nfs_apply_failed)
|
14
15
|
error_key(:nfs_update_exports_failed)
|
16
|
+
error_key(:nfs_guest_clean)
|
17
|
+
error_key(:nfs_create_mounts_failed)
|
18
|
+
end
|
19
|
+
|
20
|
+
class NFSServerMissing < Error
|
21
|
+
error_key(:nfs_server_missing)
|
22
|
+
end
|
23
|
+
|
24
|
+
class NFSServerNotInstalledInGuest < Error
|
25
|
+
error_key(:nfs_server_not_installed)
|
15
26
|
end
|
16
27
|
|
17
28
|
end
|
@@ -1,6 +1,3 @@
|
|
1
|
-
require "log4r"
|
2
|
-
|
3
|
-
require "vagrant/util"
|
4
1
|
require "vagrant/util/retryable"
|
5
2
|
|
6
3
|
module VagrantPlugins
|
@@ -22,14 +19,22 @@ module VagrantPlugins
|
|
22
19
|
"/etc/init.d/nfs-kernel-server start"
|
23
20
|
end
|
24
21
|
|
22
|
+
def self.nfs_check_command(env)
|
23
|
+
"/etc/init.d/nfs-kernel-server status"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.nfs_test_command(env)
|
27
|
+
"which exportfs"
|
28
|
+
end
|
29
|
+
|
25
30
|
def self.nfs_exports_template(machine)
|
26
31
|
VagrantPlugins::SyncedFolderNFSGuest.source_root.join(
|
27
32
|
"templates/nfs_guest/guest_export_linux")
|
28
33
|
end
|
29
34
|
|
30
35
|
def self.nfs_capable?(machine)
|
31
|
-
|
32
|
-
machine.communicate.test(
|
36
|
+
nfs_test_command = machine.guest.capability(:nfs_test_command)
|
37
|
+
machine.communicate.test(nfs_test_command)
|
33
38
|
end
|
34
39
|
|
35
40
|
def self.nfs_apply_changes!(machine)
|
@@ -48,7 +53,16 @@ module VagrantPlugins
|
|
48
53
|
)
|
49
54
|
end
|
50
55
|
|
56
|
+
def self.nfs_running?(machine)
|
57
|
+
nfs_test_command = machine.guest.capability(:nfs_check_command)
|
58
|
+
machine.communicate.test(nfs_test_command)
|
59
|
+
end
|
60
|
+
|
51
61
|
def self.nfs_export(machine, ip, folders)
|
62
|
+
if !nfs_capable?(machine)
|
63
|
+
raise Errors::NFSServerMissing
|
64
|
+
end
|
65
|
+
|
52
66
|
nfs_exports_template = machine.guest.capability(:nfs_exports_template)
|
53
67
|
|
54
68
|
nfs_opts_setup(machine, folders)
|
@@ -65,7 +79,7 @@ module VagrantPlugins
|
|
65
79
|
|
66
80
|
nfs_cleanup(machine)
|
67
81
|
|
68
|
-
retryable(on: Errors::GuestNFSError, tries: 8, sleep: 3) do
|
82
|
+
retryable(on: Errors::GuestNFSError, tries: 8, sleep: 3) do
|
69
83
|
output.split("\n").each do |line|
|
70
84
|
machine.communicate.sudo(
|
71
85
|
%Q[echo '#{line}' >> /etc/exports],
|
@@ -74,7 +88,7 @@ module VagrantPlugins
|
|
74
88
|
)
|
75
89
|
end
|
76
90
|
|
77
|
-
if
|
91
|
+
if nfs_running?(machine)
|
78
92
|
nfs_apply_changes!(machine)
|
79
93
|
else
|
80
94
|
nfs_start!(machine)
|
@@ -83,16 +97,20 @@ module VagrantPlugins
|
|
83
97
|
end
|
84
98
|
|
85
99
|
def self.nfs_cleanup(machine)
|
100
|
+
return if !nfs_capable?(machine)
|
101
|
+
|
86
102
|
id = machine.id
|
87
103
|
user = Process.uid
|
88
104
|
|
89
105
|
# Use sed to just strip out the block of code which was inserted
|
90
106
|
# by Vagrant
|
91
107
|
#
|
92
|
-
|
93
|
-
machine,
|
108
|
+
machine.communicate.sudo(
|
94
109
|
"sed -r -e '/^# VAGRANT-BEGIN:( #{user})? #{id}/,/^# " +
|
95
|
-
"VAGRANT-END:( #{user})? #{id}/ d' -ibak /etc/exports"
|
110
|
+
"VAGRANT-END:( #{user})? #{id}/ d' -ibak /etc/exports",
|
111
|
+
error_class: Errors::GuestNFSError,
|
112
|
+
error_key: :nfs_guest_clean
|
113
|
+
)
|
96
114
|
end
|
97
115
|
|
98
116
|
def self.nfs_opts_setup(machine, folders)
|
@@ -117,23 +135,27 @@ module VagrantPlugins
|
|
117
135
|
# Expand the guest path so we can handle things like "~/vagrant"
|
118
136
|
expanded_guest_path = machine.guest.capability(
|
119
137
|
:shell_expand_guest_path, opts[:guestpath])
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
138
|
+
|
139
|
+
retryable(on: Errors::GuestNFSError, tries: 8, sleep: 3) do
|
140
|
+
# Do the actual creating and mounting
|
141
|
+
machine.communicate.sudo(
|
142
|
+
"mkdir -p #{expanded_guest_path}",
|
143
|
+
error_class: Errors::GuestNFSError,
|
144
|
+
error_key: :nfs_create_mounts_failed
|
145
|
+
)
|
146
|
+
machine.communicate.sudo(
|
147
|
+
"chown -R vagrant:vagrant #{expanded_guest_path}",
|
148
|
+
error_class: Errors::GuestNFSError,
|
149
|
+
error_key: :nfs_create_mounts_failed
|
150
|
+
)
|
151
|
+
machine.communicate.sudo(
|
152
|
+
"chmod 2775 #{expanded_guest_path}",
|
153
|
+
error_class: Errors::GuestNFSError,
|
154
|
+
error_key: :nfs_create_mounts_failed
|
155
|
+
)
|
130
156
|
end
|
131
157
|
end
|
132
158
|
end
|
133
|
-
|
134
|
-
def self.machine_do(machine, command)
|
135
|
-
machine.communicate.sudo(command)
|
136
|
-
end
|
137
159
|
end
|
138
160
|
end
|
139
161
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module SyncedFolderNFSGuest
|
3
|
+
module GuestUbuntu
|
4
|
+
module Cap
|
5
|
+
class NFSServer
|
6
|
+
def self.nfs_server_install(machine)
|
7
|
+
machine.communicate.sudo("apt-get update")
|
8
|
+
machine.communicate.sudo("apt-get -y install nfs-kernel-server")
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.nfs_server_installed(machine)
|
12
|
+
machine.communicate.test("test -e /etc/init.d/nfs-kernel-server")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,31 +1,31 @@
|
|
1
|
-
require "log4r"
|
2
|
-
|
3
1
|
module VagrantPlugins
|
4
|
-
module
|
5
|
-
module
|
6
|
-
|
2
|
+
module SyncedFolderNFSGuest
|
3
|
+
module HostBSD
|
4
|
+
module Cap
|
5
|
+
class MountNFS
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
def self.nfs_mount(environment, ui, id, ips, folders)
|
8
|
+
folders.each do |name, opts|
|
9
|
+
if opts[:type] != :nfs_guest
|
10
|
+
next
|
11
|
+
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
ips.each do |ip|
|
14
|
+
ui.detail(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
|
15
|
+
guestpath: opts[:guestpath],
|
16
|
+
hostpath: opts[:hostpath]))
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
system("mkdir -p #{opts[:hostpath]}")
|
19
|
+
mount_command = "mount -t nfs -o noatime '#{ip}:#{opts[:guestpath]}' '#{opts[:hostpath]}'"
|
20
|
+
if system(mount_command)
|
21
|
+
break
|
22
|
+
end
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
25
25
|
end
|
26
|
-
end
|
27
26
|
|
28
|
-
|
27
|
+
end
|
28
|
+
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -1,33 +1,33 @@
|
|
1
|
-
require "log4r"
|
2
|
-
|
3
1
|
module VagrantPlugins
|
4
|
-
module
|
5
|
-
module
|
6
|
-
|
2
|
+
module SyncedFolderNFSGuest
|
3
|
+
module HostBSD
|
4
|
+
module Cap
|
5
|
+
class UnmountNFS
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
def self.nfs_unmount(environment, ui, folders)
|
8
|
+
folders.each do |name, opts|
|
9
|
+
if opts[:type] != :nfs_guest
|
10
|
+
next
|
11
|
+
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
ui.detail(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
|
14
|
+
guestpath: opts[:guestpath],
|
15
|
+
hostpath: opts[:hostpath]))
|
17
16
|
|
18
|
-
|
19
|
-
|
17
|
+
expanded_host_path = `printf #{opts[:hostpath]}`
|
18
|
+
umount_msg = `umount '#{expanded_host_path}' 2>&1`
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
if $?.exitstatus != 0
|
21
|
+
if not umount_msg.include? 'not currently mounted'
|
22
|
+
ui.info "NFS mounts still in use!"
|
23
|
+
exit(1)
|
24
|
+
end
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
|
-
end
|
29
28
|
|
30
|
-
|
29
|
+
end
|
30
|
+
end
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -51,11 +51,26 @@ module VagrantPlugins
|
|
51
51
|
GuestLinux::Cap::NFSExport
|
52
52
|
end
|
53
53
|
|
54
|
+
guest_capability(:linux, :nfs_test_command) do
|
55
|
+
require_relative "guests/linux/cap/nfs_export"
|
56
|
+
GuestLinux::Cap::NFSExport
|
57
|
+
end
|
58
|
+
|
54
59
|
guest_capability(:linux, :nfs_exports_template) do
|
55
60
|
require_relative "guests/linux/cap/nfs_export"
|
56
61
|
GuestLinux::Cap::NFSExport
|
57
62
|
end
|
58
63
|
|
64
|
+
guest_capability(:ubuntu, "nfs_server_installed") do
|
65
|
+
require_relative "guests/ubuntu/cap/nfs_server"
|
66
|
+
GuestUbuntu::Cap::NFSServer
|
67
|
+
end
|
68
|
+
|
69
|
+
guest_capability(:ubuntu, :nfs_server_install) do
|
70
|
+
require_relative "guests/ubuntu/cap/nfs_server"
|
71
|
+
GuestUbuntu::Cap::NFSServer
|
72
|
+
end
|
73
|
+
|
59
74
|
guest_capability(:linux, :read_uid) do
|
60
75
|
require_relative "guests/linux/cap/read_user_ids"
|
61
76
|
GuestLinux::Cap::ReadUserIDs
|
@@ -66,6 +81,16 @@ module VagrantPlugins
|
|
66
81
|
GuestLinux::Cap::ReadUserIDs
|
67
82
|
end
|
68
83
|
|
84
|
+
host_capability("bsd", "nfs_mount") do
|
85
|
+
require_relative "hosts/bsd/cap/mount_nfs"
|
86
|
+
HostBSD::Cap::MountNFS
|
87
|
+
end
|
88
|
+
|
89
|
+
host_capability("bsd", "nfs_unmount") do
|
90
|
+
require_relative "hosts/bsd/cap/unmount_nfs"
|
91
|
+
HostBSD::Cap::UnmountNFS
|
92
|
+
end
|
93
|
+
|
69
94
|
action_hook(:nfs_guest, :machine_action_up) do |hook|
|
70
95
|
require_relative "action/prepare_nfs_guest_settings"
|
71
96
|
hook.after(
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'zlib'
|
2
|
-
require 'json'
|
3
2
|
|
4
3
|
module VagrantPlugins
|
5
4
|
module SyncedFolderNFSGuest
|
@@ -11,7 +10,6 @@ module VagrantPlugins
|
|
11
10
|
return false
|
12
11
|
end
|
13
12
|
return true if machine.env.host.capability(:nfs_installed)
|
14
|
-
return true if machine.guest.capability(:nfs_installed)
|
15
13
|
return false if !raise_error
|
16
14
|
raise Vagrant::Errors::NFSNotSupported
|
17
15
|
end
|
@@ -20,6 +18,16 @@ module VagrantPlugins
|
|
20
18
|
raise Vagrant::Errors::NFSNoHostIP if !nfsopts[:nfs_guest_host_ip]
|
21
19
|
raise Vagrant::Errors::NFSNoGuestIP if !nfsopts[:nfs_guest_machine_ip]
|
22
20
|
|
21
|
+
if machine.guest.capability?(:nfs_server_installed)
|
22
|
+
installed = machine.guest.capability(:nfs_server_installed)
|
23
|
+
if !installed
|
24
|
+
can_install = machine.guest.capability?(:nfs_server_install)
|
25
|
+
raise Errors::NFSServerNotInstalledInGuest if !can_install
|
26
|
+
machine.ui.info I18n.t("vagrant_nfs_guest.guests.linux.nfs_server_installing")
|
27
|
+
machine.guest.capability(:nfs_server_install)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
23
31
|
machine_ip = nfsopts[:nfs_guest_machine_ip]
|
24
32
|
machine_ip = [machine_ip] if !machine_ip.is_a?(Array)
|
25
33
|
|
data/lib/vagrant-nfs_guest.rb
CHANGED
data/templates/locales/en.yml
CHANGED
@@ -9,6 +9,7 @@ en:
|
|
9
9
|
guests:
|
10
10
|
linux:
|
11
11
|
nfs_export: "Preparing to edit /etc/exports on the guest..."
|
12
|
+
nfs_server_installing: "Installing nfs server on the guest..."
|
12
13
|
|
13
14
|
errors:
|
14
15
|
nfs_update_exports_failed: |-
|
@@ -41,3 +42,9 @@ en:
|
|
41
42
|
|
42
43
|
Stderr from the command:
|
43
44
|
%{stderr}
|
45
|
+
|
46
|
+
nfs_server_missing: |-
|
47
|
+
Guest is missing the required NFS server daemon.
|
48
|
+
|
49
|
+
nfs_server_not_installed: |-
|
50
|
+
Guest cannot install the required NFS server daemon.
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan Garfield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -50,6 +50,8 @@ files:
|
|
50
50
|
- LICENSE.txt
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
|
+
- example_box/Vagrantfile
|
54
|
+
- example_box/vagrant_share/.keep
|
53
55
|
- lib/vagrant-nfs_guest.rb
|
54
56
|
- lib/vagrant-nfs_guest/action/mount_nfs.rb
|
55
57
|
- lib/vagrant-nfs_guest/action/prepare_nfs_guest_settings.rb
|
@@ -58,9 +60,9 @@ files:
|
|
58
60
|
- lib/vagrant-nfs_guest/errors.rb
|
59
61
|
- lib/vagrant-nfs_guest/guests/linux/cap/nfs_export.rb
|
60
62
|
- lib/vagrant-nfs_guest/guests/linux/cap/read_user_ids.rb
|
63
|
+
- lib/vagrant-nfs_guest/guests/ubuntu/cap/nfs_server.rb
|
61
64
|
- lib/vagrant-nfs_guest/hosts/bsd/cap/mount_nfs.rb
|
62
65
|
- lib/vagrant-nfs_guest/hosts/bsd/cap/unmount_nfs.rb
|
63
|
-
- lib/vagrant-nfs_guest/hosts/bsd/plugin.rb
|
64
66
|
- lib/vagrant-nfs_guest/plugin.rb
|
65
67
|
- lib/vagrant-nfs_guest/synced_folder.rb
|
66
68
|
- lib/vagrant-nfs_guest/version.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require "vagrant"
|
2
|
-
|
3
|
-
module VagrantPlugins
|
4
|
-
module HostBSD
|
5
|
-
class Plugin < Vagrant.plugin("2")
|
6
|
-
|
7
|
-
host_capability("bsd", "nfs_mount") do
|
8
|
-
require_relative "cap/mount_nfs"
|
9
|
-
Cap::MountNFS
|
10
|
-
end
|
11
|
-
|
12
|
-
host_capability("bsd", "nfs_unmount") do
|
13
|
-
require_relative "cap/unmount_nfs"
|
14
|
-
Cap::UnmountNFS
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|