diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-07-13 14:01:24 -0700 |
---|---|---|
committer | Markus Roberts <Markus@reality.com> | 2010-07-13 23:09:36 -0700 |
commit | 2edf7fe968ac3d8af9865f65100940747c1fa894 (patch) | |
tree | af448dd1b48af1b75421e56f3f1bb68f86284ca9 /lib/puppet/resource.rb | |
parent | 27d5a4782c442908c71bb9abac9f78654581eacf (diff) | |
download | puppet-2edf7fe968ac3d8af9865f65100940747c1fa894.tar.gz puppet-2edf7fe968ac3d8af9865f65100940747c1fa894.tar.xz puppet-2edf7fe968ac3d8af9865f65100940747c1fa894.zip |
[#3656] Serializing arrays of references
My previous fix for #3656 missed the case where a "require" attribute
(or other graph-ish attribute) had multiple values. This patch
generalizes that fix to the multiple-value case.
Diffstat (limited to 'lib/puppet/resource.rb')
-rw-r--r-- | lib/puppet/resource.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index 9894f2f9e..31237e3b1 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -60,11 +60,8 @@ class Puppet::Resource # Don't duplicate the title as the namevar next hash if param == namevar and value == title - if value.is_a? Puppet::Resource - hash[param] = value.to_s - else - hash[param] = value - end + + hash[param] = Puppet::Resource.value_to_pson_data(value) hash end @@ -73,6 +70,16 @@ class Puppet::Resource data end + def self.value_to_pson_data(value) + if value.is_a? Array + value.map{|v| value_to_pson_data(v) } + elsif value.is_a? Puppet::Resource + value.to_s + else + value + end + end + def to_pson(*args) to_pson_data_hash.to_pson(*args) end |