summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-11-01 13:16:39 -0600
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit329527f5173d17c9c2b788734033534009efcf04 (patch)
tree0164f85505d568c6585714b8fd69ee48aa487920 /lib
parentf8d7c44fea37dff3e9a86652699bffeab0fbe111 (diff)
downloadpuppet-329527f5173d17c9c2b788734033534009efcf04.tar.gz
puppet-329527f5173d17c9c2b788734033534009efcf04.tar.xz
puppet-329527f5173d17c9c2b788734033534009efcf04.zip
Changing SimpleGraph.matching_edges to expect one event
It previously worked with multiple, but the only caller actually only ever passed one event. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-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.