summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/compiler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/compiler.rb')
-rw-r--r--lib/puppet/parser/compiler.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index 613fcae74..c1daade4c 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -15,15 +15,19 @@ class Puppet::Parser::Compiler
include Puppet::Resource::TypeCollectionHelper
def self.compile(node)
+ # We get these from the environment and only cache them in a thread
+ # variable for the duration of the compilation. If nothing else is using
+ # the thread, though, we can leave 'em hanging round with no ill effects,
+ # and this is safer than cleaning them at the end and assuming that will
+ # stick until the next entry to this function.
+ Thread.current[:known_resource_types] = nil
+ Thread.current[:env_module_directories] = nil
+
+ # ...and we actually do the compile now we have caching ready.
new(node).compile.to_resource
rescue => detail
puts detail.backtrace if Puppet[:trace]
raise Puppet::Error, "#{detail} on node #{node.name}"
- ensure
- # We get these from the environment and only cache them in a thread
- # variable for the duration of the compilation.
- Thread.current[:known_resource_types] = nil
- Thread.current[:env_module_directories] = nil
end
attr_reader :node, :facts, :collections, :catalog, :node_scope, :resources, :relationships