Signed-off-by: Jesse Wolfe <[email protected]>
---
lib/puppet/node/environment.rb | 4 ++++
lib/puppet/resource/type_collection.rb | 2 ++
spec/unit/node/environment_spec.rb | 2 ++
3 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb
index 81f8f2c..eacbb97 100644
--- a/lib/puppet/node/environment.rb
+++ b/lib/puppet/node/environment.rb
@@ -77,6 +77,10 @@ class Puppet::Node::Environment
@known_resource_types
end
+ def known_resource_types=(type_collection)
+ @known_resource_types = type_collection
+ end
+
def module(name)
mod = Puppet::Module.new(name, self)
return nil unless mod.exist?
diff --git a/lib/puppet/resource/type_collection.rb
b/lib/puppet/resource/type_collection.rb
index 4dbf753..1ee1173 100644
--- a/lib/puppet/resource/type_collection.rb
+++ b/lib/puppet/resource/type_collection.rb
@@ -9,6 +9,8 @@ class Puppet::Resource::TypeCollection
def initialize(env)
@environment = env.is_a?(String) ? Puppet::Node::Environment.new(env)
: env
+ @environment.known_resource_types = self
+
@hostclasses = {}
@definitions = {}
@nodes = {}
diff --git a/spec/unit/node/environment_spec.rb
b/spec/unit/node/environment_spec.rb
index d0db250..86dbf27 100755
--- a/spec/unit/node/environment_spec.rb
+++ b/spec/unit/node/environment_spec.rb
@@ -56,6 +56,7 @@ describe Puppet::Node::Environment do
end
it "should create a resource type collection if none exists" do
+ @env.known_resource_types = nil
Puppet::Resource::TypeCollection.expects(:new).with(@env).returns
@collection
@env.known_resource_types.should equal(@collection)
end
@@ -65,6 +66,7 @@ describe Puppet::Node::Environment do
end
it "should perform the initial import when creating a new collection"
do
+ @env.known_resource_types = nil
@collection.expects(:perform_initial_import)
Puppet::Resource::TypeCollection.expects(:new).returns @collection
--
1.7.0.4
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.