vagrant/plugins/guests/redhat/cap/nfs_client.rb

33 lines
844 B
Ruby

module VagrantPlugins
module GuestRedHat
module Cap
class NFSClient
def self.nfs_client_install(machine)
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")
end
end
end
end
end
end