Please review pull request #270: Bug/2.7.x/11333 type ensurable doesn't work opened by (daniel-pittman)

Description:

Puppet::Type.ensurable? incorrectly returns true even when
public_method_defined?(:exists?) is false because the check
never actually happens due to a bug. This fix handles this
and simplifies the code.

  • Opened: Tue Dec 13 22:52:17 UTC 2011
  • Based on: puppetlabs:2.7.x (40313fa143ed97d9b4f83f150ba2d5c8811d40e3)
  • Requested merge: daniel-pittman:bug/2.7.x/11333-type-ensurable-doesn't-work (51cf7854dd8c66245c2358d624691b549809ec1f)

Diff follows:

diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 94f26cf..5671984 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -107,11 +107,9 @@ def self.ensurable(&block)
   def self.ensurable?
     # If the class has all three of these methods defined, then it's
     # ensurable.
-    ens = [:exists?, :create, :destroy].inject { |set, method|
-      set &&= self.public_method_defined?(method)
+    [:exists?, :create, :destroy].all? { |method|
+      self.public_method_defined?(method)
     }
-
-    ens
   end
 
   def self.apply_to_device

    

--
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