summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/node/environment.rb22
-rw-r--r--lib/puppet/resource/type_collection.rb18
2 files changed, 21 insertions, 19 deletions
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb
index 3f67474f9..ad11a0476 100644
--- a/lib/puppet/node/environment.rb
+++ b/lib/puppet/node/environment.rb
@@ -81,7 +81,7 @@ class Puppet::Node::Environment
Thread.current[:known_resource_types] ||= synchronize {
if @known_resource_types.nil? or @known_resource_types.stale?
@known_resource_types = Puppet::Resource::TypeCollection.new(self)
- @known_resource_types.perform_initial_import
+ perform_initial_import
end
@known_resource_types
}
@@ -143,5 +143,25 @@ class Puppet::Node::Environment
end
end
+ private
+
+ def perform_initial_import
+ return if Puppet.settings[:ignoreimport]
+ parser = Puppet::Parser::Parser.new(self)
+ if code = Puppet.settings.uninterpolated_value(:code, name.to_s) and code != ""
+ parser.string = code
+ else
+ file = Puppet.settings.value(:manifest, name.to_s)
+ return unless File.exist?(file)
+ parser.file = file
+ end
+ parser.parse
+ rescue => detail
+ msg = "Could not parse for environment #{self}: #{detail}"
+ error = Puppet::Error.new(msg)
+ error.set_backtrace(detail.backtrace)
+ raise error
+ end
+
@root = new(:'*root*')
end
diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb
index 3a327e264..4254b037e 100644
--- a/lib/puppet/resource/type_collection.rb
+++ b/lib/puppet/resource/type_collection.rb
@@ -110,24 +110,6 @@ class Puppet::Resource::TypeCollection
end
end
- def perform_initial_import
- return if Puppet.settings[:ignoreimport]
- parser = Puppet::Parser::Parser.new(environment)
- if code = Puppet.settings.uninterpolated_value(:code, environment.to_s) and code != ""
- parser.string = code
- else
- file = Puppet.settings.value(:manifest, environment.to_s)
- return unless File.exist?(file)
- parser.file = file
- end
- parser.parse
- rescue => detail
- msg = "Could not parse for environment #{environment}: #{detail}"
- error = Puppet::Error.new(msg)
- error.set_backtrace(detail.backtrace)
- raise error
- end
-
def stale?
@watched_files.values.detect { |file| file.changed? }
end