guests/suse: Install NFS client in one command
This commit is contained in:
parent
94af771b71
commit
c259032f80
|
@ -3,12 +3,11 @@ module VagrantPlugins
|
||||||
module Cap
|
module Cap
|
||||||
class NFSClient
|
class NFSClient
|
||||||
def self.nfs_client_install(machine)
|
def self.nfs_client_install(machine)
|
||||||
machine.communicate.tap do |comm|
|
machine.communicate.sudo <<-EOH.gsub(/^ {12}/, '')
|
||||||
comm.sudo("zypper -n install nfs-client")
|
zypper -n install nfs-client
|
||||||
|
/sbin/service rpcbind restart
|
||||||
comm.sudo("/sbin/service rpcbind restart")
|
/sbin/service nfs restart
|
||||||
comm.sudo("/sbin/service nfs restart")
|
EOH
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
require_relative "../../../../base"
|
||||||
|
|
||||||
|
describe "VagrantPlugins::GuestSUSE::Cap::NFSClient" do
|
||||||
|
let(:caps) do
|
||||||
|
VagrantPlugins::GuestSUSE::Plugin
|
||||||
|
.components
|
||||||
|
.guest_capabilities[:suse]
|
||||||
|
end
|
||||||
|
|
||||||
|
let(:machine) { double("machine") }
|
||||||
|
let(:comm) { VagrantTests::DummyCommunicator::Communicator.new(machine) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(machine).to receive(:communicate).and_return(comm)
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
comm.verify_expectations!
|
||||||
|
end
|
||||||
|
|
||||||
|
describe ".nfs_client_install" do
|
||||||
|
let(:cap) { caps.get(:nfs_client_install) }
|
||||||
|
|
||||||
|
it "installs nfs client utilities" do
|
||||||
|
cap.nfs_client_install(machine)
|
||||||
|
expect(comm.received_commands[0]).to match(/zypper -n install nfs-client/)
|
||||||
|
expect(comm.received_commands[0]).to match(/service rpcbind restart/)
|
||||||
|
expect(comm.received_commands[0]).to match(/service nfs restart/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue