2014-01-10 00:58:20 +00:00
|
|
|
module VagrantPlugins
|
|
|
|
module GuestRedHat
|
|
|
|
module Cap
|
|
|
|
class NFSClient
|
|
|
|
def self.nfs_client_install(machine)
|
2015-06-30 08:21:58 +00:00
|
|
|
machine.communicate.sudo("yum -y install nfs-utils nfs-utils-lib")
|
|
|
|
restart_nfs(machine)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.nfs_client_installed(machine)
|
|
|
|
installed = machine.communicate.test("test -x /sbin/mount.nfs")
|
|
|
|
restart_nfs(machine) if installed
|
|
|
|
installed
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def self.systemd?
|
|
|
|
`ps -o comm= 1`.chomp == 'systemd'
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.restart_nfs(machine)
|
|
|
|
if systemd?
|
|
|
|
machine.communicate.sudo("/bin/systemctl restart rpcbind nfs")
|
|
|
|
else
|
|
|
|
machine.communicate.sudo("/etc/init.d/rpcbind restart; /etc/init.d/nfs restart")
|
2014-01-10 00:58:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|