diff options
author | Paul Lathrop <plathrop@digg.com> | 2010-04-06 16:23:03 -0700 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | 2fae0bded559a23dcab5338dd899e272e0d0678e (patch) | |
tree | 4eda099e7dca9c3dd4f17f75fe014e7d07445717 | |
parent | b10d35d0da8f630e004966a52ac3ecd01287d36c (diff) | |
download | puppet-2fae0bded559a23dcab5338dd899e272e0d0678e.tar.gz puppet-2fae0bded559a23dcab5338dd899e272e0d0678e.tar.xz puppet-2fae0bded559a23dcab5338dd899e272e0d0678e.zip |
Fixes #1999 - Allows the 'apt' provider to downgrade packages.
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 <plathrop@digg.com>
-rwxr-xr-x | lib/puppet/provider/package/apt.rb | 3 | ||||
-rwxr-xr-x | 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 7bbbcfe03..c43bb4dfc 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 25d74bf90..861029838 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") } |