Class: Vagrant::Hosts::Linux
Overview
Represents a Linux based host, such as Ubuntu.
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
13
|
# File 'lib/vagrant/hosts/linux.rb', line 8
def nfs?
retryable(:tries => 10, :on => TypeError) do
system("cat /proc/filesystems | grep nfsd > /dev/null 2>&1")
end
end
|
#nfs_cleanup ⇒ Object
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/vagrant/hosts/linux.rb', line 35
def nfs_cleanup
return if !File.exist?("/etc/exports")
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
|
#nfs_export(ip, folders) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/vagrant/hosts/linux.rb', line 15
def nfs_export(ip, folders)
output = TemplateRenderer.render('nfs/exports_linux',
:uuid => env.vm.uuid,
:ip => ip,
:folders => folders)
env.ui.info I18n.t("vagrant.hosts.linux.nfs_export.prepare")
sleep 0.5
output.split("\n").each do |line|
system(%Q[sudo su root -c "echo '#{line}' >> /etc/exports"])
end
system("sudo /etc/init.d/nfs-kernel-server restart")
end
|