diff options
author | James Turnbull <james@lovedthanlost.net> | 2008-02-14 08:11:41 +1100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-02-14 08:11:41 +1100 |
commit | 9f224f2327ca691f4263e36708ef4e7386b2c4b4 (patch) | |
tree | b4d2302a9e36ce9f0a8944c3eabd0ee1c4c29cf9 /lib/puppet | |
parent | 8cfe4e7a984eb92afd92fa1128d2fa8c1a021976 (diff) | |
parent | a42c3ae7eba819053d8f01a339a9c865092d15e2 (diff) | |
download | puppet-9f224f2327ca691f4263e36708ef4e7386b2c4b4.tar.gz puppet-9f224f2327ca691f4263e36708ef4e7386b2c4b4.tar.xz puppet-9f224f2327ca691f4263e36708ef4e7386b2c4b4.zip |
Merge branch '0.24.x' of git://reductivelabs.com/puppet into 0.24.x
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/pgraph.rb | 29 | ||||
-rw-r--r-- | lib/puppet/reference/node_source.rb | 9 | ||||
-rw-r--r-- | lib/puppet/reference/report.rb | 21 | ||||
-rw-r--r-- | lib/puppet/simple_graph.rb | 15 |
4 files changed, 9 insertions, 65 deletions
diff --git a/lib/puppet/pgraph.rb b/lib/puppet/pgraph.rb index 71547802e..3bcc2ced0 100644 --- a/lib/puppet/pgraph.rb +++ b/lib/puppet/pgraph.rb @@ -19,23 +19,6 @@ class Puppet::PGraph < Puppet::SimpleGraph super end - # Make sure whichever edge has a label keeps the label - def copy_label(source, target, label) - # 'require' relationships will not have a label, - # and all 'subscribe' relationships have the same - # label, at least for now. - - # Labels default to {}, so we can't just test for nil. - newlabel = label || {} - oldlabel = edge_label(source, target) || {} - if ! newlabel.empty? and oldlabel.empty? - edge_label_set(source, target, label) - # We should probably check to see if the labels both exist - # and don't match, but we'd just throw an error which the user - # couldn't do anyting about. - end - end - # Which resources a given resource depends upon. def dependents(resource) tree_from_vertex(resource).keys @@ -115,23 +98,11 @@ class Puppet::PGraph < Puppet::SimpleGraph t = edge.target end - # We don't want to add multiple copies of the - # same edge, but we *do* want to make sure we - # keep labels around. - # XXX This will *not* work when we support multiple - # types of labels, and only works now because - # you can only do simple subscriptions. - if edge?(s, t) - copy_label(s, t, edge.label) - next - end add_edge(s, t, edge.label) end # Now get rid of the edge, so remove_vertex! works correctly. remove_edge!(edge) - Puppet.debug "%s: %s => %s: %s" % [container, - edge.source, edge.target, edge?(edge.source, edge.target)] end end remove_vertex!(container) diff --git a/lib/puppet/reference/node_source.rb b/lib/puppet/reference/node_source.rb deleted file mode 100644 index 29a01f850..000000000 --- a/lib/puppet/reference/node_source.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'puppet/node' - -noderef = Puppet::Util::Reference.newreference :node_source, :doc => "Sources of node configuration information" do - Puppet::Network::Handler.node.docs -end - -noderef.header = " -Nodes can be searched for in different locations. This document describes those different locations. -" diff --git a/lib/puppet/reference/report.rb b/lib/puppet/reference/report.rb deleted file mode 100644 index a8086f8bc..000000000 --- a/lib/puppet/reference/report.rb +++ /dev/null @@ -1,21 +0,0 @@ -report = Puppet::Util::Reference.newreference :report, :doc => "All available transaction reports" do - Puppet::Network::Handler.report.reportdocs -end - -report.header = " -Puppet clients can report back to the server after each transaction. This -transaction report is sent as a YAML dump of the -``Puppet::Transaction::Report`` class and includes every log message that was -generated during the transaction along with as many metrics as Puppet knows how -to collect. See `ReportsAndReporting Reports and Reporting`:trac: -for more information on how to use reports. - -Currently, clients default to not sending in reports; you can enable reporting -by setting the ``report`` parameter to true. - -To use a report, set the ``reports`` parameter on the server; multiple -reports must be comma-separated. You can also specify ``none`` to disable -reports entirely. - -Puppet provides multiple report handlers that will process client reports: -" diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 503e4814c..48f393f77 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -51,10 +51,12 @@ class Puppet::SimpleGraph # Create methods for returning the degree and edges. [:in, :out].each do |direction| - define_method("%s_degree" % direction) do - @adjacencies[direction].length - end - + # LAK:NOTE If you decide to create methods for directly + # testing the degree, you'll have to get the values and flatten + # the results -- you might have duplicate edges, which can give + # a false impression of what the degree is. That's just + # as expensive as just getting the edge list, so I've decided + # to only add this method. define_method("%s_edges" % direction) do @adjacencies[direction].values.flatten end @@ -126,8 +128,9 @@ class Puppet::SimpleGraph # Collect each of our vertices, with the number of in-edges each has. @vertices.each do |name, wrapper| - zeros << wrapper if wrapper.in_degree == 0 - degree[wrapper.vertex] = wrapper.in_edges + edges = wrapper.in_edges + zeros << wrapper if edges.length == 0 + degree[wrapper.vertex] = edges end # Iterate over each 0-degree vertex, decrementing the degree of |