From: Daniel Pittman <[email protected]>
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.
---
lib/puppet/simple_graph.rb | 6 ++++--
spec/unit/simple_graph_spec.rb | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index 29e46c9..f9a665d 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 0d1a3b4..58978f2 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
--
1.7.3.5
--
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.