vagrant-nfs4j 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/nfs4j-daemon.exe +0 -0
- data/bin/nfs4j-daemon.jar +0 -0
- data/lib/vagrant-nfs4j/cap/nfs.rb +1 -1
- data/lib/vagrant-nfs4j/config/nfs4j.rb +3 -3
- data/lib/vagrant-nfs4j/nfs4j_daemon/errors.rb +4 -0
- data/lib/vagrant-nfs4j/nfs4j_daemon/wrapper.rb +31 -13
- data/lib/vagrant-nfs4j/version.rb +1 -1
- data/locales/en.yml +13 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0a9b39c373275cbb8f6a5ae4a42e9af0cd2e36708a1ae950d953983bfc93cf7
|
4
|
+
data.tar.gz: e12a47e43796bb011fd393de9ff0b1d1ee818737e373ef785799f57644a840ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 170fcee451dfbc574d9492ca0a57c2d30e5e66ceed094705c96ab689d22a8f3fc6d589aac3689054b1bf07e4fee634b9b02680a716b28b6f141c6f0e50ebfa1e
|
7
|
+
data.tar.gz: 67bcb391cfb2cc49f1ea97a553755aac13b5972015769ce50a5013032f3eaf5c1ff9c6b4d9b584b835d7dc4f73eec9858de227a1977c77649369adcb91c3f6f7
|
data/Gemfile.lock
CHANGED
data/bin/nfs4j-daemon.exe
CHANGED
Binary file
|
data/bin/nfs4j-daemon.jar
CHANGED
Binary file
|
@@ -7,6 +7,7 @@ module VagrantNfs4j
|
|
7
7
|
attr_accessor :shares_config
|
8
8
|
attr_accessor :host_ip
|
9
9
|
attr_accessor :api_port
|
10
|
+
attr_accessor :setup_firewall
|
10
11
|
attr_accessor :daemon_start
|
11
12
|
attr_accessor :daemon_exe
|
12
13
|
attr_accessor :daemon_jar
|
@@ -19,6 +20,7 @@ module VagrantNfs4j
|
|
19
20
|
@shares_config = UNSET_VALUE
|
20
21
|
@host_ip = UNSET_VALUE
|
21
22
|
@api_port = UNSET_VALUE
|
23
|
+
@setup_firewall = UNSET_VALUE
|
22
24
|
@daemon_start = UNSET_VALUE
|
23
25
|
@daemon_exe = UNSET_VALUE
|
24
26
|
@daemon_jar = UNSET_VALUE
|
@@ -33,9 +35,6 @@ module VagrantNfs4j
|
|
33
35
|
errors << 'nfs4j.shares_config cannot be nil.' if machine.config.nfs4j.shares_config.nil?
|
34
36
|
errors << 'nfs4j.host_ip cannot be nil.' if machine.config.nfs4j.host_ip.nil?
|
35
37
|
errors << 'nfs4j.api_port cannot be nil.' if machine.config.nfs4j.api_port.nil?
|
36
|
-
errors << 'nfs4j.daemon_start cannot be nil.' if machine.config.nfs4j.daemon_start.nil?
|
37
|
-
errors << 'nfs4j.daemon_exe cannot be nil.' if machine.config.nfs4j.daemon_exe.nil?
|
38
|
-
errors << 'nfs4j.daemon_jar cannot be nil.' if machine.config.nfs4j.daemon_jar.nil?
|
39
38
|
|
40
39
|
{"nsf4j" => errors}
|
41
40
|
end
|
@@ -45,6 +44,7 @@ module VagrantNfs4j
|
|
45
44
|
@shares_config = {} if @shares_config == UNSET_VALUE
|
46
45
|
@host_ip = "" if @host_ip == UNSET_VALUE
|
47
46
|
@api_port = 9732 if @api_port == UNSET_VALUE
|
47
|
+
@setup_firewall = true if @setup_firewall == UNSET_VALUE
|
48
48
|
@daemon_start = true if @daemon_start == UNSET_VALUE
|
49
49
|
@daemon_exe = true if @daemon_exe == UNSET_VALUE
|
50
50
|
@daemon_jar = true if @daemon_jar == UNSET_VALUE
|
@@ -32,7 +32,7 @@ module VagrantNfs4j
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def setup_firewall(ui, java_home)
|
35
|
+
def setup_firewall(ui, setup_firewall, java_home)
|
36
36
|
java_exe = if java_home
|
37
37
|
additional_path = File.join(java_home, 'bin')
|
38
38
|
VagrantNfs4j::Utils.which("java", additional_path)
|
@@ -42,13 +42,15 @@ module VagrantNfs4j
|
|
42
42
|
|
43
43
|
java_exe = java_exe.gsub('/', '\\')
|
44
44
|
|
45
|
-
|
45
|
+
ports = [2049, @api_port]
|
46
|
+
|
47
|
+
rule_name = "vagrant-nfs4j-#{VagrantNfs4j::VERSION}-#{java_exe}-tcp-#{ports.join(',')}".gsub('\\', '-').gsub(':', '')
|
46
48
|
rule_exist = "netsh advfirewall firewall show rule name=\"#{rule_name}\">nul"
|
47
49
|
|
48
50
|
unless system(sprintf(rule_exist, rule_name))
|
49
|
-
ui.detail(I18n.t('vagrant_nfs4j.nfs4j_daemon.installing_firewall_rule', rule_name: rule_name))
|
50
51
|
|
51
|
-
|
52
|
+
|
53
|
+
rule_template = "advfirewall firewall add rule name=\"%s\" dir=\"%s\" action=allow protocol=TCP localport=#{ports.join(',')} program=\"%s\" profile=any"
|
52
54
|
|
53
55
|
all_rules = []
|
54
56
|
all_rules.push("advfirewall firewall delete rule name=\"#{rule_name}\"")
|
@@ -62,29 +64,44 @@ module VagrantNfs4j
|
|
62
64
|
firewall_rule += " \" #{rule}\""
|
63
65
|
end
|
64
66
|
|
65
|
-
if
|
66
|
-
ui.detail(I18n.t('vagrant_nfs4j.nfs4j_daemon.
|
67
|
+
if setup_firewall
|
68
|
+
ui.detail(I18n.t('vagrant_nfs4j.nfs4j_daemon.installing_firewall_rule', rule_name: rule_name))
|
69
|
+
|
70
|
+
if system(firewall_rule) and system(sprintf(rule_exist, rule_name))
|
71
|
+
ui.detail(I18n.t('vagrant_nfs4j.nfs4j_daemon.firewall_rule_installed', rule_name: rule_name))
|
72
|
+
else
|
73
|
+
ui.detail(I18n.t('vagrant_nfs4j.nfs4j_daemon.firewall_error'))
|
74
|
+
all_rules.each do |rule|
|
75
|
+
puts "netsh #{rule}"
|
76
|
+
end
|
77
|
+
end
|
67
78
|
else
|
68
|
-
ui.detail(I18n.t('vagrant_nfs4j.
|
79
|
+
ui.detail(I18n.t('vagrant_nfs4j.nfs4j_daemon.firewall_manual'))
|
69
80
|
all_rules.each do |rule|
|
70
|
-
|
81
|
+
puts "netsh #{rule}"
|
71
82
|
end
|
72
83
|
end
|
73
84
|
end
|
74
85
|
end
|
75
86
|
|
76
|
-
def is_running(should_raise_start_failed = false)
|
87
|
+
def is_running(should_raise_start_failed = false, ui = nil)
|
77
88
|
unless @api_port
|
78
89
|
return false
|
79
90
|
end
|
80
91
|
begin
|
81
|
-
r = RestClient.get "http://localhost:#{@api_port}/ping", {accept: :json}.merge(self.headers())
|
92
|
+
r = RestClient::Request.execute method: :get, url: "http://localhost:#{@api_port}/ping", headers: {accept: :json}.merge(self.headers()), timeout: 5
|
82
93
|
data = JSON.parse(r.body)
|
83
94
|
return data === 'pong'
|
84
95
|
rescue
|
85
96
|
if should_raise_start_failed
|
86
97
|
raise StartFailed
|
87
98
|
end
|
99
|
+
if ui
|
100
|
+
if $!.is_a?(RestClient::Exceptions::Timeout)
|
101
|
+
raise TimeoutError
|
102
|
+
end
|
103
|
+
end
|
104
|
+
ui.detail(I18n.t('vagrant_nfs4j.nfs4j_daemon.check_has_failed_retrying', {:cause => Nfs4jDaemonErrors.get_message($!)})) if ui
|
88
105
|
end
|
89
106
|
false
|
90
107
|
end
|
@@ -141,11 +158,12 @@ module VagrantNfs4j
|
|
141
158
|
cmd = "start \"vagrant-nfs4j-daemon\" #{bin}#{opts}"
|
142
159
|
ui.detail(I18n.t('vagrant_nfs4j.nfs4j_daemon.is_starting', cmd: cmd))
|
143
160
|
|
144
|
-
pid = spawn(cmd)
|
145
|
-
Process.detach(pid)
|
161
|
+
#pid = spawn(cmd)
|
162
|
+
#Process.detach(pid)
|
146
163
|
|
147
164
|
i = 0
|
148
|
-
|
165
|
+
check_start_time = Time.now
|
166
|
+
until self.is_running(Time.now - check_start_time > 30, ui)
|
149
167
|
sleep 1
|
150
168
|
i += 1
|
151
169
|
end
|
data/locales/en.yml
CHANGED
@@ -15,16 +15,28 @@ en:
|
|
15
15
|
NFS share detach has failed. (%{cause})
|
16
16
|
status_failed: |-
|
17
17
|
NFS share status can't be retrieved. (%{cause})
|
18
|
+
timeout_error: |-
|
19
|
+
nfs4j-daemon might be started, but the vagrant process (ruby.exe) is not able to access to its HTTP Endpoint
|
20
|
+
throw the network (timeout). You should check your network and firewall configuration to allow this
|
21
|
+
connection to be done. (%{cause})
|
18
22
|
is_already_running: |-
|
19
23
|
nfs4j-daemon is running and ready to serve.
|
20
24
|
is_starting: |-
|
21
25
|
nfs4j-daemon is going to start with the following command (%{cmd})
|
26
|
+
check_has_failed_retrying: |-
|
27
|
+
Waiting for nfs4j-daemon to be started. Retrying check ... (%{cause})
|
22
28
|
has_been_started: |-
|
23
29
|
nfs4j-daemon has been started and is ready to serve.
|
24
30
|
installing_firewall_rule: |-
|
25
|
-
Installing
|
31
|
+
Installing Windows firewall rule %{rule_name}.
|
26
32
|
firewall_rule_installed: |-
|
27
33
|
Windows firewall rule %{rule_name} has been installed.
|
34
|
+
firewall_error: |-
|
35
|
+
It seems that you don't have the privileges to change the Windows firewall rules. NFS may not work without
|
36
|
+
custom firewall rules. Execute the following commands as administrator:
|
37
|
+
firewall_manual: |-
|
38
|
+
Setup of the Windows firewall is dsabled. NFS may not work without custom firewall rules.
|
39
|
+
Execute the following commands as administrator:
|
28
40
|
cap:
|
29
41
|
nfs_export:
|
30
42
|
attaching_share: |-
|
@@ -34,7 +46,3 @@ en:
|
|
34
46
|
nfs_prune:
|
35
47
|
pruning_share: |-
|
36
48
|
Pruning orphan NFS share from nfs4j-daemon: %{path} => %{alias}
|
37
|
-
firewall:
|
38
|
-
error: |-
|
39
|
-
It seems that you don't have the privileges to change the firewall rules. NFS will not work without that firewall
|
40
|
-
changes. Execute the following commands via cmd as administrator:
|