guests/redhat: Install RedHat in one command
This commit is contained in:
parent
3098c13869
commit
60d2f4e1b4
|
@ -3,13 +3,13 @@ module VagrantPlugins
|
|||
module Cap
|
||||
class RSync
|
||||
def self.rsync_install(machine)
|
||||
machine.communicate.tap do |comm|
|
||||
if VagrantPlugins::GuestRedHat::Plugin.dnf?(machine)
|
||||
comm.sudo("dnf -y install rsync")
|
||||
machine.communicate.sudo <<-EOH.gsub(/^ {12}/, '')
|
||||
if command -v dnf; then
|
||||
dnf -y install rsync
|
||||
else
|
||||
comm.sudo("yum -y install rsync")
|
||||
end
|
||||
end
|
||||
yum -y install rsync
|
||||
fi
|
||||
EOH
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
require_relative "../../../../base"
|
||||
|
||||
describe "VagrantPlugins::GuestRedHat::Cap:RSync" do
|
||||
let(:caps) do
|
||||
VagrantPlugins::GuestRedHat::Plugin
|
||||
.components
|
||||
.guest_capabilities[:redhat]
|
||||
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 ".rsync_install" do
|
||||
let(:cap) { caps.get(:rsync_install) }
|
||||
|
||||
it "installs rsync" do
|
||||
cap.rsync_install(machine)
|
||||
expect(comm.received_commands[0]).to match(/install rsync/)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue