summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/resource.rb6
-rwxr-xr-xspec/unit/resource.rb7
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb
index f991f539d..d2979f930 100644
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@ -60,7 +60,11 @@ class Puppet::Resource
# Don't duplicate the title as the namevar
next hash if param == namevar and value == title
- hash[param] = value
+ if value.is_a? Puppet::Resource
+ hash[param] = value.to_s
+ else
+ hash[param] = value
+ end
hash
end
diff --git a/spec/unit/resource.rb b/spec/unit/resource.rb
index 0eacd0b90..3840db535 100755
--- a/spec/unit/resource.rb
+++ b/spec/unit/resource.rb
@@ -664,6 +664,13 @@ describe Puppet::Resource do
result["foo"].should == %w{bar eh}
result["fee"].should == %w{baz}
end
+
+ it "should serialize relationships as reference strings" do
+ resource = Puppet::Resource.new("File", "/foo")
+ resource[:requires] = Puppet::Resource.new("File", "/bar")
+ result = Puppet::Resource.from_pson(PSON.parse(resource.to_pson))
+ result[:requires].should == "File[/bar]"
+ end
end
describe "when converting from pson" do