summaryrefslogtreecommitdiffstats
path: root/lib/puppet/simple_graph.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/simple_graph.rb')
-rw-r--r--lib/puppet/simple_graph.rb26
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index 5e8f5cdb7..91603945c 100644
--- a/lib/puppet/simple_graph.rb
+++ b/lib/puppet/simple_graph.rb
@@ -145,21 +145,19 @@ class Puppet::SimpleGraph
# Collect all of the edges that the passed events match. Returns
# an array of edges.
- def matching_edges(events, base = nil)
- events.collect do |event|
- source = base || event.source
+ def matching_edges(event, base = nil)
+ source = base || event.resource
- unless vertex?(source)
- Puppet.warning "Got an event from invalid vertex %s" % source.ref
- next
- end
- # Get all of the edges that this vertex should forward events
- # to, which is the same thing as saying all edges directly below
- # This vertex in the graph.
- adjacent(source, :direction => :out, :type => :edges).find_all do |edge|
- edge.match?(event.name)
- end
- end.compact.flatten
+ unless vertex?(source)
+ Puppet.warning "Got an event from invalid vertex #{source.ref}"
+ return []
+ end
+ # Get all of the edges that this vertex should forward events
+ # to, which is the same thing as saying all edges directly below
+ # This vertex in the graph.
+ adjacent(source, :direction => :out, :type => :edges).find_all do |edge|
+ edge.match?(event.name)
+ end
end
# Return a reversed version of this graph.