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
|
|
|
|
|
2015-07-13 06:18:27 +00:00
|
|
|
def self.systemd?(machine)
|
|
|
|
machine.communicate.test("test $(ps -o comm= 1) == 'systemd'")
|
2015-06-30 08:21:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.restart_nfs(machine)
|
2015-07-13 06:18:27 +00:00
|
|
|
if systemd?(machine)
|
2015-06-30 08:21:58 +00:00
|
|
|
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
|