On 26/03/10 18:32, Markus Roberts wrote:
>>>> brice:tickets/0.25.x/3396 (Faster event propagation) succeeded:
>
>>> > * 7c3cd8c Fix inefficient SimpleGraph#matching_edge
>>> > 7771 examples, 28 failures, 41 pending
>>> > 4 more in unit/simple_graph.rb (4 total)
>>>
>>>
>>> This is not good. Looks like we are missing Luke's glue event
>>> patch, or
>>> there is something at play here.
>>>
>>> The event-->events patch appears to be there; the problem appears to
>>> be with the event.source patch (all of the errors look like this):
>>
>> That's what I was thinking.
>>
>> But I also remember Luke saying:
>>> On Mar 21, 2010, at 9:50 AM, Brice Figureau wrote:
>>>> I explored Lak's repositories and found that event.source was
>>> renamed
>>>> into event.resource (apparently).
>>>
>>> Something like that - it looks like that should work for the
>>> purposes
>>> of this, although I'd definitely test it. I think for most cases
>>> both
>>> the resource and property will be set (to strings), but I think
>>> there
>>> are some cases where just the source_description is set. For some
>>> reason I've made 'log_source' a private method; this would probably
>>> actually be the best thing to use, since it picks the best value.
>>
>> So, I'm puzzled: we lost event.source, and got event.resource instead
>> that is a string (ie a resource ref and not an resource instance
>> anymore), so clearly my patch can't work directly (it needs resource
>> instances).
>>
>
> This seems to have been lost in the merge; but the line that appears to have
> been lost:
>
> source = base || event.resource
Which previously was:
source = base || event.source
> leads to odd transformations when translated to the present code (e.g. right
> after your branch is merged into testing):
>
> diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
> index 37a08e7..9c04a32 100644
> --- a/lib/puppet/simple_graph.rb
> +++ b/lib/puppet/simple_graph.rb
> @@ -158,11 +158,11 @@ class Puppet::SimpleGraph
> if base
> # consider only edges which are not pointing to any event
> sources
> # which is what a recursive file resources produces
> - event_sources = events.inject({}) { |hash, event|
> hash[event.source] = event.source ; hash}
> - edges = (adjacent(base, :direction => :out, :type => :edges) -
> event_sources.keys)
> + event_sources = {base => base}
> + edges = (adjacent(base, :direction => :out, :type => :edges) -
> [base])
> else
This compares apples to oranges: the idea is to get the list of all
incoming event source (resource strings now), then to remove them from
the list of adjacent vertices (resources instances).
The issue, assuming event.resource contains a resource ref string (I'm
still not sure about this), is to find the correct resource instances
(ie vertices in the graph) so that we can exclude them from the adjacent
vertices.
> In the if-base clause, source would always == base, and walking that fact
> through leads to code that I suspect must be wrong.
No the code is correct, it is just not equivalent to what it was previously.
--
Brice Figureau
My Blog: http://www.masterzen.fr/
--
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.