diff options
| author | Luke Kanies <luke@madstop.com> | 2007-11-08 11:28:34 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-11-08 11:28:34 -0600 |
| commit | f465e7e96d62f9b18bdebd51319582d5b2ffa332 (patch) | |
| tree | c33a94d5430d42a702735554c2110c149eae349d /lib/puppet/node | |
| parent | 65858356cb3170e04200a6d8204f0978223e2c61 (diff) | |
| parent | 1ffcce079fd7a677ebdc22453a9d10675fb4ed4d (diff) | |
| download | puppet-f465e7e96d62f9b18bdebd51319582d5b2ffa332.tar.gz puppet-f465e7e96d62f9b18bdebd51319582d5b2ffa332.tar.xz puppet-f465e7e96d62f9b18bdebd51319582d5b2ffa332.zip | |
Merge branch 'rest'
Diffstat (limited to 'lib/puppet/node')
| -rw-r--r-- | lib/puppet/node/configuration.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/puppet/node/configuration.rb b/lib/puppet/node/configuration.rb index f2bbfca00..e49090d70 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 @@ -78,6 +83,7 @@ class Puppet::Node::Configuration < Puppet::PGraph transaction.addtimes :config_retrieval => @retrieval_duration + begin transaction.evaluate rescue Puppet::Error => detail @@ -167,6 +173,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 +282,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 +292,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| @@ -293,7 +305,7 @@ class Puppet::Node::Configuration < Puppet::PGraph # Lastly, add in any autorequires @relationship_graph.vertices.each do |vertex| vertex.autorequire.each do |edge| - unless @relationship_graph.edge?(edge) + 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) |
