summaryrefslogtreecommitdiffstats
path: root/lib/puppet/node
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-09-20 12:57:57 -0500
committerLuke Kanies <luke@madstop.com>2007-09-20 12:57:57 -0500
commit46d69068fa7b2f3448294c5d3da21c69cef73d2f (patch)
tree8abf532af73d4fd7d68d894db639004e331318bc /lib/puppet/node
parent9fa2628a844c75b8f554f283dfece01667f20594 (diff)
downloadpuppet-46d69068fa7b2f3448294c5d3da21c69cef73d2f.tar.gz
puppet-46d69068fa7b2f3448294c5d3da21c69cef73d2f.tar.xz
puppet-46d69068fa7b2f3448294c5d3da21c69cef73d2f.zip
An intermediate commit so I can start working on a different
branch. The file recursion code actually works for the first time in a painful while, but there are still some quirks and design issues to resolve, particularly around creating implicit resources that then fail (i.e., the behaviour of the create_implicit_resource method in Configuration).
Diffstat (limited to 'lib/puppet/node')
-rw-r--r--lib/puppet/node/configuration.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/puppet/node/configuration.rb b/lib/puppet/node/configuration.rb
index c882e0ee1..de6e776c5 100644
--- a/lib/puppet/node/configuration.rb
+++ b/lib/puppet/node/configuration.rb
@@ -55,13 +55,13 @@ class Puppet::Node::Configuration < Puppet::PGraph
# Apply our configuration to the local host.
def apply
+ @applying = true
+
Puppet::Util::Storage.load if host_config?
transaction = Puppet::Transaction.new(self)
transaction.addtimes :config_retrieval => @retrieval_duration
- @applying = true
-
begin
transaction.evaluate
rescue Puppet::Error => detail
@@ -122,6 +122,7 @@ class Puppet::Node::Configuration < Puppet::PGraph
unless options.include?(:implicit)
options[:implicit] = true
end
+ # LAK:FIXME catch exceptions here and return nil when problems
if resource = create_resource(type, options)
resource.implicit = true
@@ -235,6 +236,7 @@ class Puppet::Node::Configuration < Puppet::PGraph
@resource_table = {}
@transient_resources = []
@applying = false
+ @relationship_graph = nil
if block_given?
yield(self)
@@ -245,11 +247,12 @@ class Puppet::Node::Configuration < Puppet::PGraph
# Create a graph of all of the relationships in our configuration.
def relationship_graph
unless defined? @relationship_graph and @relationship_graph
- relationships = self.class.new
+ relationships = Puppet::Node::Configuration.new
+ relationships.host_config = host_config?
# First create the dependency graph
self.vertices.each do |vertex|
- relationships.add_resource vertex
+ relationships.add_vertex! vertex
vertex.builddepends.each do |edge|
relationships.add_edge!(edge)
end
@@ -287,6 +290,7 @@ class Puppet::Node::Configuration < Puppet::PGraph
resources.each do |resource|
@resource_table.delete(resource.ref) if @resource_table.include?(resource.ref)
remove_vertex!(resource) if vertex?(resource)
+ @relationship_graph.remove_vertex!(resource) if @relationship_graph and @relationship_graph.vertex?(resource)
resource.remove
end
end
@@ -345,6 +349,7 @@ class Puppet::Node::Configuration < Puppet::PGraph
unless @transient_resources.empty?
remove_resource(*@transient_resources)
@transient_resources.clear
+ @relationship_graph = nil
end
end
end