Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/puppet/provider/package/yum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def self.latest_package_version(package, disablerepo, enablerepo, disableexclude
# @return [Hash<String, Array<Hash<String, String>>>] All packages that were
# found with a list of found versions for each package.
def self.check_updates(disablerepo, enablerepo, disableexcludes)
args = [command(:cmd), 'check-update']
args = [command(:cmd), '-y', 'check-update']
args.concat(disablerepo.map { |repo| ["--disablerepo=#{repo}"] }.flatten)
args.concat(enablerepo.map { |repo| ["--enablerepo=#{repo}"] }.flatten)
args.concat(disableexcludes.map { |repo| ["--disableexcludes=#{repo}"] }.flatten)
Expand Down
10 changes: 5 additions & 5 deletions spec/shared_examples/rhel_package_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,39 +327,39 @@
describe "executing #{provider_name} check-update" do
it "passes repos to enable to '#{provider_name} check-update'" do
expect(Puppet::Util::Execution).to receive(:execute).with(
%W[/usr/bin/#{provider_name} check-update --enablerepo=updates --enablerepo=centosplus],
%W[/usr/bin/#{provider_name} -y check-update --enablerepo=updates --enablerepo=centosplus],
any_args
).and_return(double(:exitstatus => 0))
described_class.check_updates([], %W[updates centosplus], [])
end

it "passes repos to disable to '#{provider_name} check-update'" do
expect(Puppet::Util::Execution).to receive(:execute).with(
%W[/usr/bin/#{provider_name} check-update --disablerepo=updates --disablerepo=centosplus],
%W[/usr/bin/#{provider_name} -y check-update --disablerepo=updates --disablerepo=centosplus],
any_args
).and_return(double(:exitstatus => 0))
described_class.check_updates(%W[updates centosplus], [], [])
end

it "passes a combination of repos to enable and disable to '#{provider_name} check-update'" do
expect(Puppet::Util::Execution).to receive(:execute).with(
%W[/usr/bin/#{provider_name} check-update --disablerepo=updates --disablerepo=centosplus --enablerepo=os --enablerepo=contrib ],
%W[/usr/bin/#{provider_name} -y check-update --disablerepo=updates --disablerepo=centosplus --enablerepo=os --enablerepo=contrib ],
any_args
).and_return(double(:exitstatus => 0))
described_class.check_updates(%W[updates centosplus], %W[os contrib], [])
end

it "passes disableexcludes to '#{provider_name} check-update'" do
expect(Puppet::Util::Execution).to receive(:execute).with(
%W[/usr/bin/#{provider_name} check-update --disableexcludes=main --disableexcludes=centosplus],
%W[/usr/bin/#{provider_name} -y check-update --disableexcludes=main --disableexcludes=centosplus],
any_args
).and_return(double(:exitstatus => 0))
described_class.check_updates([], [], %W[main centosplus])
end

it "passes all options to '#{provider_name} check-update'" do
expect(Puppet::Util::Execution).to receive(:execute).with(
%W[/usr/bin/#{provider_name} check-update --disablerepo=a --disablerepo=b --enablerepo=c --enablerepo=d --disableexcludes=e --disableexcludes=f],
%W[/usr/bin/#{provider_name} -y check-update --disablerepo=a --disablerepo=b --enablerepo=c --enablerepo=d --disableexcludes=e --disableexcludes=f],
any_args
).and_return(double(:exitstatus => 0))
described_class.check_updates(%W[a b], %W[c d], %W[e f])
Expand Down