This is accomplished by adding the --force-yes option to the apt-get command line when a package version is specified.
Signed-off-by: Paul Lathrop <[email protected]> --- lib/puppet/provider/package/apt.rb | 3 ++- spec/unit/provider/package/apt.rb | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index 7bbbcfe..c43bb4d 100755 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -64,8 +64,9 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do when true, false, Symbol # pass else - # Add the package version + # Add the package version and --force-yes option str += "=%s" % should + cmd << "--force-yes" end cmd << :install << str diff --git a/spec/unit/provider/package/apt.rb b/spec/unit/provider/package/apt.rb index 25d74bf..8610298 100755 --- a/spec/unit/provider/package/apt.rb +++ b/spec/unit/provider/package/apt.rb @@ -109,6 +109,13 @@ Version table: @provider.install end + it "should use --force-yes if a package version is specified" do + @resource.expects(:[]).with(:ensure).returns "1.0" + @provider.expects(:aptget).with { |*command| command.include?("--force-yes") } + + @provider.install + end + it "should do a quiet install" do @provider.expects(:aptget).with { |*command| command.include?("-q") } -- 1.7.0 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
