diff --git a/lib/puppet/provider/package/yum.rb b/lib/puppet/provider/package/yum.rb index ac9c126d7a..27af23513b 100644 --- a/lib/puppet/provider/package/yum.rb +++ b/lib/puppet/provider/package/yum.rb @@ -111,7 +111,7 @@ def self.latest_package_version(package, disablerepo, enablerepo, disableexclude # @return [Hash>>] 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) diff --git a/spec/shared_examples/rhel_package_provider.rb b/spec/shared_examples/rhel_package_provider.rb index fa29130bce..1d31fa0112 100644 --- a/spec/shared_examples/rhel_package_provider.rb +++ b/spec/shared_examples/rhel_package_provider.rb @@ -327,7 +327,7 @@ 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], []) @@ -335,7 +335,7 @@ 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], [], []) @@ -343,7 +343,7 @@ 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], []) @@ -351,7 +351,7 @@ 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]) @@ -359,7 +359,7 @@ 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])