Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PUP-7042) Mark strings in graph #5580

Merged
merged 2 commits into from Apr 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/puppet/graph/simple_graph.rb
Expand Up @@ -61,7 +61,7 @@ def matching_edges(event, base = nil)
source = base || event.resource

unless vertex?(source)
Puppet.warning "Got an event from invalid vertex #{source.ref}"
Puppet.warning _("Got an event from invalid vertex %{source}") % { source: source.ref }
return []
end
# Get all of the edges that this vertex should forward events
Expand Down Expand Up @@ -193,7 +193,8 @@ def find_cycles_in_graph
# through the graph first, which are more likely to be interesting to the
# user. I think; it would be interesting to verify that. --daniel 2011-01-23
def paths_in_cycle(cycle, max_paths = 1)
raise ArgumentError, "negative or zero max_paths" if max_paths < 1
#TRANSLATORS "negative or zero" refers to the count of paths
raise ArgumentError, _("negative or zero max_paths") if max_paths < 1

# Calculate our filtered outbound vertex lists...
adj = {}
Expand Down Expand Up @@ -225,18 +226,19 @@ def report_cycles_in_graph
return if n == 0
s = n == 1 ? '' : 's'

message = "Found #{n} dependency cycle#{s}:\n"
message = n_("Found %{num} dependency cycle:\n", "Found %{num} dependency cycles:\n", n) % { num: n }
cycles.each do |cycle|
paths = paths_in_cycle(cycle)
message += paths.map{ |path| '(' + path.join(" => ") + ')'}.join("\n") + "\n"
end

if Puppet[:graph] then
filename = write_cycles_to_graph(cycles)
message += "Cycle graph written to #{filename}."
message += _("Cycle graph written to %{filename}.") % { filename: filename }
else
message += "Try the '--graph' option and opening the "
message += "resulting '.dot' file in OmniGraffle or GraphViz"
#TRANSLATORS "graph" refers to a command line option and should not be translated
#TRANSLATORS OmniGraffle and GraphViz and program names and should not be translated
message += _("Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz")
end

raise Puppet::Error, message
Expand Down