diff options
author | Luke Kanies <luke@madstop.com> | 2008-08-04 10:28:10 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-08-04 10:28:10 -0500 |
commit | c854dbe416939a930776405a5fa7ac87f84901d8 (patch) | |
tree | 8096c4f321099f8050ca0369acd9110b4094ab9a /lib/puppet | |
parent | 818599db7dc6210cc015d8888d119726eb6c3323 (diff) | |
download | puppet-c854dbe416939a930776405a5fa7ac87f84901d8.tar.gz puppet-c854dbe416939a930776405a5fa7ac87f84901d8.tar.xz puppet-c854dbe416939a930776405a5fa7ac87f84901d8.zip |
Adding a plaintext network format.
Certs don't seem to support yaml, for some reason.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/network/formats.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb index 79e2860af..bd171fa7d 100644 --- a/lib/puppet/network/formats.rb +++ b/lib/puppet/network/formats.rb @@ -28,12 +28,12 @@ end Puppet::Network::FormatHandler.create(:marshal, :mime => "text/marshal") do - # Yaml doesn't need the class name; it's serialized. + # Marshal doesn't need the class name; it's serialized. def intern(klass, text) Marshal.load(text) end - # Yaml doesn't need the class name; it's serialized. + # Marshal doesn't need the class name; it's serialized. def intern_multiple(klass, text) Marshal.load(text) end @@ -52,3 +52,23 @@ Puppet::Network::FormatHandler.create(:marshal, :mime => "text/marshal") do true end end + +Puppet::Network::FormatHandler.create(:str, :mime => "text/plain") do + # For now, use the YAML separator. + SEPARATOR = "\n---\n" + + # Yaml doesn't need the class name; it's serialized. + def intern_multiple(klass, text) + text.split(SEPARATOR).collect { |inst| intern(klass, inst) } + end + + # Yaml monkey-patches Array, so this works. + def render_multiple(instances) + instances.collect { |inst| render(inst) }.join(SEPARATOR) + end + + # Everything's supported + def supported?(klass) + true + end +end |