Issue #17775 has been updated by Dan Bode.

I tried switching that != to == to see if any tests would fail

<pre>
  19) Puppet::Resource#prune_parameters should strip all parameters and strip 
properties that are nil, empty or absent except for ensure
     Failure/Error: pruned_resource.should == Puppet::Resource.new("blond", 
"Bambi", :parameters => {:ensure => 'absent'})
       expected: Blond[Bambi]{:ensure=>"absent", :name=>"Bambi"}
            got: Blond[Bambi]{:weight=>"absent", :name=>"Bambi"} (using ==)
       Diff:
       @@ -1,2 +1,2 @@
       -Blond[Bambi]{:ensure=>"absent", :name=>"Bambi"}
       +Blond[Bambi]{:weight=>"absent", :name=>"Bambi"}
     # ./spec/unit/resource_spec.rb:939
</pre>

It looks like (according to this test) that this behavior is on perfect. Does 
anyone know why?
----------------------------------------
Bug #17775: puppet resource removes any properties from its output whose value 
is absent
https://projects.puppetlabs.com/issues/17775#change-77336

Author: Dan Bode
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


the following code from Puppet::Resource

<pre>
380   def prune_parameters(options = {})
381     properties = resource_type.properties.map(&:name)
382 
383     dup.collect do |attribute, value|
384       if value.to_s.empty? or Array(value).empty?
385         delete(attribute)
386       elsif value.to_s == "absent" and attribute.to_s != "ensure"
387         delete(attribute)
388       end
</pre>

removes any attributes from the output of the puppet resource command whose 
value is absent. I noticed it while debugging a missing attribute (whose value 
happened to be absent)

I am a little confused by what that code is intended to do. Is it possible that 
!= should be an == ?


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to