diff options
| author | Luke Kanies <luke@madstop.com> | 2008-02-11 18:27:49 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-02-11 18:27:49 -0600 |
| commit | 8b2fae019b31513becd002eb474e1b4803abde24 (patch) | |
| tree | 92312a50927ff65a8b78fbec7fff52d3bf59eb78 /lib | |
| parent | cf21ade9abf4541920b535b0e2643b30e44b067b (diff) | |
| download | puppet-8b2fae019b31513becd002eb474e1b4803abde24.tar.gz puppet-8b2fae019b31513becd002eb474e1b4803abde24.tar.xz puppet-8b2fae019b31513becd002eb474e1b4803abde24.zip | |
Removing the last remaining vestiges of GRATR --
removing the bangs from 'add_vertex!' and 'add_edge!'.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/node/catalog.rb | 10 | ||||
| -rw-r--r-- | lib/puppet/parser/compiler.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/pgraph.rb | 14 | ||||
| -rw-r--r-- | lib/puppet/simple_graph.rb | 8 | ||||
| -rw-r--r-- | lib/puppet/transaction.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/transportable.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/type/pfile.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/util/graph.rb | 2 |
8 files changed, 19 insertions, 27 deletions
diff --git a/lib/puppet/node/catalog.rb b/lib/puppet/node/catalog.rb index 96f60b179..b74947107 100644 --- a/lib/puppet/node/catalog.rb +++ b/lib/puppet/node/catalog.rb @@ -69,7 +69,7 @@ class Puppet::Node::Catalog < Puppet::PGraph @resource_table[ref] = resource resource.catalog = self if resource.respond_to?(:catalog=) and ! is_relationship_graph - add_vertex!(resource) + add_vertex(resource) end end @@ -316,9 +316,9 @@ class Puppet::Node::Catalog < Puppet::PGraph # First create the dependency graph self.vertices.each do |vertex| - @relationship_graph.add_vertex! vertex + @relationship_graph.add_vertex vertex vertex.builddepends.each do |edge| - @relationship_graph.add_edge!(edge) + @relationship_graph.add_edge(edge) end end @@ -328,7 +328,7 @@ class Puppet::Node::Catalog < Puppet::PGraph unless @relationship_graph.edge?(edge.source, edge.target) # don't let automatic relationships conflict with manual ones. unless @relationship_graph.edge?(edge.target, edge.source) vertex.debug "Autorequiring %s" % [edge.source] - @relationship_graph.add_edge!(edge) + @relationship_graph.add_edge(edge) else vertex.debug "Skipping automatic relationship with %s" % (edge.source == vertex ? edge.target : edge.source) end @@ -487,7 +487,7 @@ class Puppet::Node::Catalog < Puppet::PGraph raise Puppet::DevError, "Could not find resource %s when converting %s resources" % [edge.target.ref, message] end - result.add_edge!(source, target, edge.label) + result.add_edge(source, target, edge.label) end map.clear diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 27860487a..26fdd3743 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -36,7 +36,7 @@ class Puppet::Parser::Compiler # And in the resource graph. At some point, this might supercede # the global resource table, but the table is a lot faster # so it makes sense to maintain for now. - @catalog.add_edge!(scope.resource, resource) + @catalog.add_edge(scope.resource, resource) end # Do we use nodes found in the code, vs. the external node sources? @@ -184,7 +184,7 @@ class Puppet::Parser::Compiler options[:compiler] = self options[:parser] ||= self.parser scope = Puppet::Parser::Scope.new(options) - @scope_graph.add_edge!(parent, scope) + @scope_graph.add_edge(parent, scope) scope end @@ -383,7 +383,7 @@ class Puppet::Parser::Compiler def init_main # Create our initial scope and a resource that will evaluate main. @topscope = Puppet::Parser::Scope.new(:compiler => self, :parser => self.parser) - @scope_graph.add_vertex!(@topscope) + @scope_graph.add_vertex(@topscope) end # Set up all of our internal variables. diff --git a/lib/puppet/pgraph.rb b/lib/puppet/pgraph.rb index 54b815b45..71547802e 100644 --- a/lib/puppet/pgraph.rb +++ b/lib/puppet/pgraph.rb @@ -7,17 +7,14 @@ require 'puppet/simple_graph' # This class subclasses a graph class in order to handle relationships # among resources. class Puppet::PGraph < Puppet::SimpleGraph - # This is the type used for splicing. - attr_accessor :container_type - include Puppet::Util - def add_edge!(*args) + def add_edge(*args) @reversal = nil super end - def add_vertex!(*args) + def add_vertex(*args) @reversal = nil super end @@ -57,11 +54,6 @@ class Puppet::PGraph < Puppet::SimpleGraph @reversal.tree_from_vertex(resource, :out).keys end - # Override this method to use our class instead. - def edge_class() - Puppet::Relationship - end - # Determine all of the leaf nodes below a given vertex. def leaves(vertex, direction = :out) tree = tree_from_vertex(vertex, direction) @@ -133,7 +125,7 @@ class Puppet::PGraph < Puppet::SimpleGraph copy_label(s, t, edge.label) next end - add_edge!(s, t, edge.label) + add_edge(s, t, edge.label) end # Now get rid of the edge, so remove_vertex! works correctly. diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 11542ad53..503e4814c 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -100,10 +100,10 @@ class Puppet::SimpleGraph # Return a reversed version of this graph. def reversal result = self.class.new - vertices.each { |vertex| result.add_vertex!(vertex) } + vertices.each { |vertex| result.add_vertex(vertex) } edges.each do |edge| newedge = edge.class.new(edge.target, edge.source, edge.label) - result.add_edge!(newedge) + result.add_edge(newedge) end result end @@ -150,7 +150,7 @@ class Puppet::SimpleGraph end # Add a new vertex to the graph. - def add_vertex!(vertex) + def add_vertex(vertex) return false if vertex?(vertex) setup_vertex(vertex) true # don't return the VertexWrapper instance. @@ -176,7 +176,7 @@ class Puppet::SimpleGraph # Add a new edge. The graph user has to create the edge instance, # since they have to specify what kind of edge it is. - def add_edge!(source, target = nil, label = nil) + def add_edge(source, target = nil, label = nil) if target edge = Puppet::Relationship.new(source, target, label) else diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index f304cadc6..976bf7c68 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -173,7 +173,7 @@ class Transaction relationship_graph.add_resource(gen_child) unless relationship_graph.resource(gen_child.ref) unless relationship_graph.edge?(edge[1], edge[0]) - relationship_graph.add_edge!(*edge) + relationship_graph.add_edge(*edge) else resource.debug "Skipping automatic relationship to %s" % gen_child end diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb index c1d68a881..f686fbb78 100644 --- a/lib/puppet/transportable.rb +++ b/lib/puppet/transportable.rb @@ -193,7 +193,7 @@ module Puppet next unless resource = child.to_type config.add_resource resource end - config.add_edge!(container, resource) + config.add_edge(container, resource) if child.is_a?(self.class) delver.call(child) end diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 7d928d959..c32a4d474 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -650,7 +650,7 @@ module Puppet # LAK:FIXME This shouldn't be necessary, but as long as we're # modeling the relationship graph specifically, it is. - catalog.relationship_graph.add_edge! self, child + catalog.relationship_graph.add_edge self, child return child end diff --git a/lib/puppet/util/graph.rb b/lib/puppet/util/graph.rb index a9744578b..d1ef36f8e 100644 --- a/lib/puppet/util/graph.rb +++ b/lib/puppet/util/graph.rb @@ -16,7 +16,7 @@ module Puppet::Util::Graph self.each do |child| unless block_given? and ! yield(child) - graph.add_edge!(self, child) + graph.add_edge(self, child) if child.respond_to?(:to_graph) child.to_graph(graph, &block) |
