diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-07-19 00:14:15 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-07-19 00:14:15 +0000 |
commit | 90c8b8c1ba74452e27c08cdcec6edb9988a07a62 (patch) | |
tree | 618b2aca281eb5046bd52efb18c5084449566bf8 | |
parent | 0316bedca52aab6383ed794439f18bd75e5f611c (diff) | |
download | puppet-90c8b8c1ba74452e27c08cdcec6edb9988a07a62.tar.gz puppet-90c8b8c1ba74452e27c08cdcec6edb9988a07a62.tar.xz puppet-90c8b8c1ba74452e27c08cdcec6edb9988a07a62.zip |
Fixing #716 -- the package type was considering anything that was not "absent" to be installed, but that included "purged", thus the problem
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2709 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | lib/puppet/type/package.rb | 27 | ||||
-rwxr-xr-x | test/ral/types/package.rb | 8 |
2 files changed, 12 insertions, 23 deletions
diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index a4b2f0e44..ed4caee2d 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -57,27 +57,14 @@ module Puppet provider.uninstall end - newvalue(:purged, :event => :package_purged) do - unless provider.purgeable? - self.fail( - "Package provider %s does not purging" % - @resource[:provider] - ) - end + newvalue(:purged, :event => :package_purged, :required_features => :purgeable) do provider.purge end # Alias the 'present' value. aliasvalue(:installed, :present) - newvalue(:latest) do - unless provider.upgradeable? - self.fail( - "Package provider %s does not support specifying 'latest'" % - @resource[:provider] - ) - end - + newvalue(:latest, :required_features => :upgradeable) do # Because yum always exits with a 0 exit code, there's a retrieve # in the "install" method. So, check the current state now, # to compare against later. @@ -95,13 +82,7 @@ module Puppet end end - newvalue(/./) do - unless provider.class.versionable? - self.fail( - "Package provider %s does not support specifying versions" % - @resource[:provider] - ) - end + newvalue(/./, :required_features => :versionable) do begin provider.install rescue => detail @@ -130,7 +111,7 @@ module Puppet @should.each { |should| case should when :present - unless is == :absent + unless [:absent, :purged].include?(is) return true end when :latest diff --git a/test/ral/types/package.rb b/test/ral/types/package.rb index 0fa02e984..95f0479a7 100755 --- a/test/ral/types/package.rb +++ b/test/ral/types/package.rb @@ -137,6 +137,14 @@ class TestPackages < Test::Unit::TestCase end end end + + # #716 + def test_purge_is_not_installed + package = @type.create(:ensure => :installed, :name => "whatever") + + property = package.property(:ensure) + assert(! property.insync?(:purged), "Package in state 'purged' was considered in sync") + end end # $Id$ |