summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@rimspace.net>2011-01-21 23:53:56 -0800
committerDaniel Pittman <daniel@rimspace.net>2011-02-03 16:45:30 -0800
commit403adb8af42cc79701b5ff47b377e7dc1e192a34 (patch)
tree09879f1d9ce1e1a63ec51337ad1eb108f122f098
parent1ad6470e3df59caf67c484ef4e43274314c0bc40 (diff)
downloadpuppet-403adb8af42cc79701b5ff47b377e7dc1e192a34.tar.gz
puppet-403adb8af42cc79701b5ff47b377e7dc1e192a34.tar.xz
puppet-403adb8af42cc79701b5ff47b377e7dc1e192a34.zip
Feature #2597 -- nicer reporting of relationships.
Split out the reporting from a single line (often with literally hundreds or thousands of items) into a multi-line report. This is still nasty, but at least it is easier to use as input to other systems. This will also auto-join to a single line when sent to targets such as syslog that do not approve of newlines in messages; this preserves the utility of the message without needing to lose console utility.
-rw-r--r--lib/puppet/simple_graph.rb6
-rwxr-xr-xspec/unit/simple_graph_spec.rb2
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index 29e46c9bd..f9a665d3c 100644
--- a/lib/puppet/simple_graph.rb
+++ b/lib/puppet/simple_graph.rb
@@ -119,8 +119,10 @@ class Puppet::SimpleGraph
if cycles = degree.values.reject { |ns| ns.empty? } and cycles.length > 0
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"
+ }.join("\n")
+ raise Puppet::Error, "Found dependency cycles in the following relationships:\n" +
+ message + "\n" +
+ "Try the '--graph' option and opening the '.dot' file in OmniGraffle or GraphViz"
end
result
diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb
index 0d1a3b4a7..58978f2ba 100755
--- a/spec/unit/simple_graph_spec.rb
+++ b/spec/unit/simple_graph_spec.rb
@@ -305,7 +305,7 @@ describe Puppet::SimpleGraph do
it "should produce the correct relationship text" do
add_edges :a => :b, :b => :a
- want = %r{following relationships: \(b => a\), \(a => b\)}
+ want = %r{following relationships:\n\(b => a\)\n\(a => b\)}
expect { @graph.topsort }.to raise_error(Puppet::Error, want)
end