Class: Vagrant::Hosts::BSD
Overview
Represents a BSD host, such as FreeBSD and Darwin (Mac OS X).
Instance Attribute Summary
Attributes inherited from Base
#env
Instance Method Summary
collapse
#retryable
Methods inherited from Base
detect, #initialize, load
Instance Method Details
#nfs? ⇒ Boolean
8
9
10
11
12
|
# File 'lib/vagrant/hosts/bsd.rb', line 8
def nfs?
retryable(:tries => 10, :on => TypeError) do
system("which nfsd > /dev/null 2>&1")
end
end
|
#nfs_cleanup ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/vagrant/hosts/bsd.rb', line 37
def nfs_cleanup
return if !File.exist?("/etc/exports")
retryable(:tries => 10, :on => TypeError) do
system("cat /etc/exports | grep 'VAGRANT-BEGIN: #{env.vm.uuid}' > /dev/null 2>&1")
if $?.to_i == 0
system("sudo sed -e '/^# VAGRANT-BEGIN: #{env.vm.uuid}/,/^# VAGRANT-END: #{env.vm.uuid}/ d' -ibak /etc/exports")
end
end
end
|
#nfs_export(ip, folders) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/vagrant/hosts/bsd.rb', line 14
def nfs_export(ip, folders)
output = TemplateRenderer.render('nfs/exports',
:uuid => env.vm.uuid,
:ip => ip,
:folders => folders)
env.ui.info I18n.t("vagrant.hosts.bsd.nfs_export.prepare")
sleep 0.5
output.split("\n").each do |line|
line = line.gsub('"', '\"')
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
end
system("sudo nfsd restart")
end
|