guests/arch: Add NFS capabilities

This commit is contained in:
Seth Vargo 2016-06-24 19:07:25 -04:00
parent cf9a8e3c0a
commit e69211ab22
No known key found for this signature in database
GPG Key ID: 905A90C2949E8787
3 changed files with 60 additions and 2 deletions

View File

@ -0,0 +1,35 @@
module VagrantPlugins
module GuestArch
module Cap
class NFS
def self.nfs_client_installed(machine)
machine.communicate.test("pacman -Q nfs-utils")
end
def self.nfs_pre(machine)
comm = machine.communicate
# There is a bug in NFS where the rpcbind functionality is not started
# and it's not a dependency of nfs-utils. Read more here:
#
# https://bbs.archlinux.org/viewtopic.php?id=193410
#
comm.sudo <<-EOH.gsub(/^ {12}/, "")
set -e
systemctl enable rpcbind
systemctl start rpcbind
EOH
end
def self.nfs_client_install(machine)
comm = machine.communicate
comm.sudo <<-EOH.gsub(/^ {12}/, "")
set -e
pacman --noconfirm -Syy
pacman --noconfirm -S nfs-utils ntp
EOH
end
end
end
end
end

View File

@ -20,6 +20,21 @@ module VagrantPlugins
require_relative "cap/configure_networks" require_relative "cap/configure_networks"
Cap::ConfigureNetworks Cap::ConfigureNetworks
end end
guest_capability(:arch, :nfs_client_install) do
require_relative "cap/nfs"
Cap::NFS
end
guest_capability(:arch, :nfs_client_installed) do
require_relative "cap/nfs"
Cap::NFS
end
guest_capability(:arch, :nfs_pre) do
require_relative "cap/nfs"
Cap::NFS
end
end end
end end
end end

View File

@ -101,8 +101,16 @@ module VagrantPlugins
end end
# Mount them! # Mount them!
machine.guest.capability( if machine.guest.capability?(:nfs_pre)
:mount_nfs_folder, nfsopts[:nfs_host_ip], mount_folders) machine.guest.capability(:nfs_pre)
end
machine.guest.capability(:mount_nfs_folder,
nfsopts[:nfs_host_ip], mount_folders)
if machine.guest.capability?(:nfs_post)
machine.guest.capability(:nfs_post)
end
end end
def cleanup(machine, opts) def cleanup(machine, opts)