summaryrefslogtreecommitdiffstats
path: root/lib/puppet/simple_graph.rb
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@rimspace.net>2011-01-21 23:32:40 -0800
committerDaniel Pittman <daniel@rimspace.net>2011-02-03 16:45:30 -0800
commit1ad6470e3df59caf67c484ef4e43274314c0bc40 (patch)
treeb1d4713b2e8c47948ccdadf88f7a32479a9ef725 /lib/puppet/simple_graph.rb
parentea348761df0b5297dbac50c7f1c48d22746524fa (diff)
downloadpuppet-1ad6470e3df59caf67c484ef4e43274314c0bc40.tar.gz
puppet-1ad6470e3df59caf67c484ef4e43274314c0bc40.tar.xz
puppet-1ad6470e3df59caf67c484ef4e43274314c0bc40.zip
Feature #2597 -- fix cycle relationship notification format.
The SimpleGraph class was reporting duplicate data when printing cycles: Notify[c]Notify[c] => Notify[d] Notify[a]Notify[a] => Notify[b] This was caused by throwing the array representation of the edge into a string, rather than just the relationship data; we only care about the later, so now we only emit that later and have the correct text in the error.
Diffstat (limited to 'lib/puppet/simple_graph.rb')
-rw-r--r--lib/puppet/simple_graph.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index 9d7f218a6..29e46c9bd 100644
--- a/lib/puppet/simple_graph.rb
+++ b/lib/puppet/simple_graph.rb
@@ -109,7 +109,7 @@ class Puppet::SimpleGraph
# each of its out-edges.
while v = zeros.pop
result << v
- @out_from[v].each { |v2,es|
+ @out_from[v].each { |v2,es|
degree[v2].delete(v)
zeros << v2 if degree[v2].empty?
}
@@ -117,7 +117,9 @@ class Puppet::SimpleGraph
# If we have any vertices left with non-zero in-degrees, then we've found a cycle.
if cycles = degree.values.reject { |ns| ns.empty? } and cycles.length > 0
- message = cycles.collect { |edges| '('+edges.collect { |e| e.to_s }.join(", ")+')' }.join(", ")
+ message = cycles.collect { |edges|
+ '(' + edges.collect { |e| e[1].to_s }.join(", ") + ')'
+ }.join(", ")
raise Puppet::Error, "Found dependency cycles in the following relationships: #{message}; try using the '--graph' option and open the '.dot' files in OmniGraffle or GraphViz"
end
@@ -141,7 +143,7 @@ class Puppet::SimpleGraph
# each of its out-edges.
while v = zeros.pop
result << v
- @out_from[v].each { |v2,es|
+ @out_from[v].each { |v2,es|
zeros << v2 if (degree[v2] -= 1) == 0
}
end