summaryrefslogtreecommitdiffstats
path: root/lib/puppet/node
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-31 11:34:06 -0500
committerLuke Kanies <luke@madstop.com>2007-10-31 11:34:06 -0500
commit826efe8d453c1cc45a980603fffc10c91fa0e267 (patch)
treed0c216e9f3784b075c0f8f361e0f67885aec430e /lib/puppet/node
parentdb293cf3b9e9dd129d8c65aa39272425651addae (diff)
downloadpuppet-826efe8d453c1cc45a980603fffc10c91fa0e267.tar.gz
puppet-826efe8d453c1cc45a980603fffc10c91fa0e267.tar.xz
puppet-826efe8d453c1cc45a980603fffc10c91fa0e267.zip
The configurations should now be functional again --
file recursion was previously not working, because the relationship graph was setting itself as a resource's primary configuration, which caused it to try creating its own relationship graph. I've now found that the current code is about 5x slower than the released code, so now I hope to resolve that.
Diffstat (limited to 'lib/puppet/node')
-rw-r--r--lib/puppet/node/configuration.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/puppet/node/configuration.rb b/lib/puppet/node/configuration.rb
index f2bbfca00..1365767b6 100644
--- a/lib/puppet/node/configuration.rb
+++ b/lib/puppet/node/configuration.rb
@@ -33,6 +33,11 @@ class Puppet::Node::Configuration < Puppet::PGraph
# that the host configuration needs.
attr_accessor :host_config
+ # Whether this graph is another configuration's relationship graph.
+ # We don't want to accidentally create a relationship graph for another
+ # relationship graph.
+ attr_accessor :is_relationship_graph
+
# Add classes to our class list.
def add_class(*classes)
classes.each do |klass|
@@ -56,7 +61,7 @@ class Puppet::Node::Configuration < Puppet::PGraph
else
@resource_table[ref] = resource
end
- resource.configuration = self
+ resource.configuration = self unless is_relationship_graph
add_vertex!(resource)
end
end
@@ -167,6 +172,9 @@ class Puppet::Node::Configuration < Puppet::PGraph
@transient_resources << resource if applying?
add_resource(resource)
+ if @relationship_graph
+ @relationship_graph.add_resource(resource) unless @relationship_graph.resource(resource.ref)
+ end
resource
end
@@ -273,6 +281,8 @@ class Puppet::Node::Configuration < Puppet::PGraph
# Create a graph of all of the relationships in our configuration.
def relationship_graph
+ raise(Puppet::DevError, "Tried get a relationship graph for a relationship graph") if self.is_relationship_graph
+
unless defined? @relationship_graph and @relationship_graph
# It's important that we assign the graph immediately, because
# the debug messages below use the relationships in the
@@ -281,6 +291,7 @@ class Puppet::Node::Configuration < Puppet::PGraph
# then we get into an infinite loop.
@relationship_graph = Puppet::Node::Configuration.new
@relationship_graph.host_config = host_config?
+ @relationship_graph.is_relationship_graph = true
# First create the dependency graph
self.vertices.each do |vertex|