diff options
author | Luke Kanies <luke@madstop.com> | 2008-08-24 13:02:16 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-08-26 22:40:40 -0700 |
commit | 3101ea23e556081fe38502218034f02aafe0c5bf (patch) | |
tree | a8530f462667629c370f31912c5088d5f9a6f273 /lib/puppet | |
parent | 89a3738d2b0678ae8fb1e7191e01caf6c5ece1f9 (diff) | |
download | puppet-3101ea23e556081fe38502218034f02aafe0c5bf.tar.gz puppet-3101ea23e556081fe38502218034f02aafe0c5bf.tar.xz puppet-3101ea23e556081fe38502218034f02aafe0c5bf.zip |
Adding a hackish raw format.
As the comment in the file says, we don't really have enough
data to know what a good design would look like, and I think
this format will be a bit of a one-off, so I'm just throwing
up some barriers to keep people from doing silly things with it.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/network/formats.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb index 8e4c59fb3..c2a8b7ab6 100644 --- a/lib/puppet/network/formats.rb +++ b/lib/puppet/network/formats.rb @@ -42,7 +42,7 @@ Puppet::Network::FormatHandler.create(:marshal, :mime => "text/marshal") do Marshal.dump(instance) end - # Yaml monkey-patches Array, so this works. + # Marshal monkey-patches Array, so this works. def render_multiple(instances) Marshal.dump(instances) end @@ -54,3 +54,23 @@ Puppet::Network::FormatHandler.create(:marshal, :mime => "text/marshal") do end Puppet::Network::FormatHandler.create(:s, :mime => "text/plain") + +Puppet::Network::FormatHandler.create(:raw, :mime => "application/x-raw") do + def intern_multiple(klass, text) + raise NotImplementedError + end + + def render_multiple(instances) + raise NotImplementedError + end + + # LAK:NOTE The format system isn't currently flexible enough to handle + # what I need to support raw formats just for individual instances (rather + # than both individual and collections), but we don't yet have enough data + # to make a "correct" design. + # So, we hack it so it works for singular but fail if someone tries it + # on plurals. + def supported?(klass) + true + end +end |