hello,

I've been playing around with P::Transaction::Report on Puppet 2.7.x
and noticed that using apply resources get added to the report 
multiple times via calls to P::T::Report#add_resource_status

In digging into it I noticed on P::Transaction the following:

def resource_status(resource)
   report.resource_statuses[resource.to_s] || 
add_resource_status(Puppet::Resource::Status.new(resource)) 
end

so this will only add the resource unless it's already been added
but then in the apply method I do not see the same constraint:

def apply(resource, ancestor = nil)
   status = resource_harness.evaluate(resource)
   add_resource_status(status)
   # etc
end

If I change this to:

def apply(resource, ancestor = nil)
   status = resource_harness.evaluate(resource)
   add_resource_status(status) unless report.resource_statuses[resource.to_s]
   # etc
end

this both avoids the dupes going into the transaction report
and cuts my puppet apply run from 12.95 seconds to 11.5 with
around 500 resources

So I don't know this code well enough to say if this is a good
thing but it seems safe and might speed things up a bit, does
anyone else know this code well and can tell me if this would
be a safe thing to do, I'll try to do a pull request then for
this change

---
R.I.Pienaar

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to