summaryrefslogtreecommitdiffstats
path: root/lib/puppet/resource.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-11-04 22:26:28 -0700
committerJames Turnbull <james@lovedthanlost.net>2010-11-10 05:31:33 +1100
commitec667fd53f9f611641755d086f09cbc61b1ca203 (patch)
tree75ff50b5439a70b81633fe59574566556c07d0a7 /lib/puppet/resource.rb
parent9a3b5849c54c3f354670b5a912fd393f7010977e (diff)
downloadpuppet-ec667fd53f9f611641755d086f09cbc61b1ca203.tar.gz
puppet-ec667fd53f9f611641755d086f09cbc61b1ca203.tar.xz
puppet-ec667fd53f9f611641755d086f09cbc61b1ca203.zip
Kludge for #5206 -- port of fix for #3536 to yaml
The internal format of parameters was changed between 0.25.x and 2.6.x, making them incompatible when serialized. This was fixed for PSON under ticket #3656 (by modifying the data as it was serialized) in: commit f66095d35bc5f9645eb19bbb8cefa342c0181d2d and commit 2edf7fe968ac3d8af9865f65100940747c1fa894 but nothing was done about the other serialization formats. This commit adds a callback to zaml property serialization and uses it to route data through the fixup method added in the commits above, thus fixing the problem "the same way" as it was fixed for PSON under #3656. It does nothing about marshal, mostly because I have not totaly gone over to the dark side (yet).
Diffstat (limited to 'lib/puppet/resource.rb')
-rw-r--r--lib/puppet/resource.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb
index 7dea270e8..4f0d50750 100644
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@ -80,6 +80,18 @@ class Puppet::Resource
end
end
+ def yaml_property_munge(x)
+ case x
+ when Hash
+ x.inject({}) { |h,kv|
+ k,v = kv
+ h[k] = self.class.value_to_pson_data(v)
+ h
+ }
+ else self.class.value_to_pson_data(x)
+ end
+ end
+
def to_pson(*args)
to_pson_data_hash.to_pson(*args)
end