The fix for #2940 resulted in a behavior change that could be seen as a
bug.  This was consistent with many of the other providers (see #3000)
but was not the desired behavior.

This patch enhances the patch for #2940 to return {:ensure => :absent} as
the present state in the case that the failure was due to the package not
being installed (as opposed to a source/index failure, etc.).  The other
possibility would have been {:ensure => :purged}.

Signed-off-by: Markus Roberts <[email protected]>
---
 lib/puppet/provider/package/sun.rb |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/provider/package/sun.rb 
b/lib/puppet/provider/package/sun.rb
index cd511b1..4f8b311 100755
--- a/lib/puppet/provider/package/sun.rb
+++ b/lib/puppet/provider/package/sun.rb
@@ -112,6 +112,7 @@ Puppet::Type.type(:package).provide :sun, :parent => 
Puppet::Provider::Package d
             }
             return hash
         rescue Puppet::ExecutionFailure => detail
+            return {:ensure => :absent} if detail.message =~ /information for 
"#{Regexp.escape(@resource[:name])}" was not found/
             puts detail.backtrace if Puppet[:trace]
             raise Puppet::Error, "Unable to get information about package 
#...@resource[:name]} because of: #{detail}"
         end
-- 
1.6.4

--

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.


Reply via email to