Parser resources were not correctly being converted
to Puppet::Resource instances, which meant a ton more
information was being kept in the catalog.

This probably didn't have much affect in real life, because
of how we serialized, but it made debugging a lot harder.

Signed-off-by: Luke Kanies <[email protected]>
---
 lib/puppet/resource/catalog.rb |    2 +-
 spec/unit/resource/catalog.rb  |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb
index e63c00c..e3eb34c 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -557,7 +557,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
             #Aliases aren't working in the ral catalog because the current 
instance of the resource
             #has a reference to the catalog being converted. . . So, give it a 
reference to the new one
             #problem solved. . .
-            if resource.is_a?(Puppet::Resource)
+            if resource.class == Puppet::Resource
                 resource = resource.dup
                 resource.catalog = result
             elsif resource.is_a?(Puppet::TransObject)
diff --git a/spec/unit/resource/catalog.rb b/spec/unit/resource/catalog.rb
index 6c6af24..c78d169 100755
--- a/spec/unit/resource/catalog.rb
+++ b/spec/unit/resource/catalog.rb
@@ -207,6 +207,14 @@ describe Puppet::Resource::Catalog, "when compiling" do
             @original.to_resource.version.should == "foo"
         end
 
+        it "should convert parser resources to plain resources" do
+            resource = Puppet::Parser::Resource.new(:file, "foo", :scope => 
stub("scope"), :source => stub("source"))
+            catalog = Puppet::Resource::Catalog.new("whev")
+            catalog.add_resource(resource)
+            new = catalog.to_resource
+            new.resource(:file, "foo").class.should == Puppet::Resource
+        end
+
         it "should add all resources as Puppet::Resource instances" do
             @resources.each { |resource| 
@catalog.resource(resource.ref).should be_instance_of(Puppet::Resource) }
         end
-- 
1.6.1

-- 
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.

Reply via email to