diff options
author | Luke Kanies <luke@madstop.com> | 2008-07-28 18:05:41 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-07-29 00:51:22 -0500 |
commit | 55e29444c15fe2f810b3d5332605f27ac5942fda (patch) | |
tree | 5cd663fa5a55920f59f04dd4fa58677078d982b1 /lib/puppet | |
parent | 4632cfd9e6ce0ff59dfa7562a02a1ae3f14488d4 (diff) | |
download | puppet-55e29444c15fe2f810b3d5332605f27ac5942fda.tar.gz puppet-55e29444c15fe2f810b3d5332605f27ac5942fda.tar.xz puppet-55e29444c15fe2f810b3d5332605f27ac5942fda.zip |
Adding support for rendering and converting multiple instances.
It's a touch hackish in terms of design, but it should work,
and it's the last major piece of plumbing necessary for REST support.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/network/format_handler.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/puppet/network/format_handler.rb b/lib/puppet/network/format_handler.rb index b569bd696..f001f8242 100644 --- a/lib/puppet/network/format_handler.rb +++ b/lib/puppet/network/format_handler.rb @@ -15,6 +15,22 @@ module Puppet::Network::FormatHandler send("from_%s" % format, data) end + def convert_from_multiple(format, data) + if respond_to?("from_multiple_%s" % format) + send("from_multiple_%s" % format, data) + else + convert_from(format, data) + end + end + + def render_multiple(format, instances) + if respond_to?("to_multiple_%s" % format) + send("to_multiple_%s" % format, instances) + else + instances.send("to_%s" % format) + end + end + def default_format supported_formats[0] end |