diff options
| author | Luke Kanies <luke@puppetlabs.com> | 2010-05-17 12:04:40 -0700 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | 3dfb7626fdc775803b94b0e009ece41198acde29 (patch) | |
| tree | aaf810bcbf7b1ca909d4923c688d82c980e712da | |
| parent | 0d4fd60c7c143cc1f4e4b0f99f359c09cbfbf21e (diff) | |
| download | puppet-3dfb7626fdc775803b94b0e009ece41198acde29.tar.gz puppet-3dfb7626fdc775803b94b0e009ece41198acde29.tar.xz puppet-3dfb7626fdc775803b94b0e009ece41198acde29.zip | |
Fixing Catalog conversion
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 <luke@puppetlabs.com>
| -rw-r--r-- | lib/puppet/resource/catalog.rb | 2 | ||||
| -rwxr-xr-x | 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 97c036b03..3a28f45c8 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -551,7 +551,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 a7caf090e..3020dc80e 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 |
