summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-08-27 12:49:54 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-08-27 12:50:26 -0700
commit21afb51a1b84116b2a906a6959ae588f45135104 (patch)
tree48fa0438d0a50202194956344d0cf1f10b17b818 /lib/puppet/network
parent1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac (diff)
parent8be1929043f4560bb17a4b06293b3f9a4efcfdbf (diff)
downloadpuppet-21afb51a1b84116b2a906a6959ae588f45135104.tar.gz
puppet-21afb51a1b84116b2a906a6959ae588f45135104.tar.xz
puppet-21afb51a1b84116b2a906a6959ae588f45135104.zip
Merge commit '2.6.1rc3'
This synchronizes the 2.7 master branch with 2.6.1RC3 The 2.7 next branch has now diverged from master for the first time, as if contains code that has not reached "release quality" status.
Diffstat (limited to 'lib/puppet/network')
-rw-r--r--lib/puppet/network/format_handler.rb6
-rw-r--r--lib/puppet/network/formats.rb8
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/puppet/network/format_handler.rb b/lib/puppet/network/format_handler.rb
index d378ad6a1..b94a4f902 100644
--- a/lib/puppet/network/format_handler.rb
+++ b/lib/puppet/network/format_handler.rb
@@ -37,6 +37,12 @@ module Puppet::Network::FormatHandler
instance
end
+ def self.create_serialized_formats(name,options = {},&block)
+ ["application/x-#{name}", "application/#{name}", "text/x-#{name}", "text/#{name}"].each { |mime_type|
+ create name, {:mime => mime_type}.update(options), &block
+ }
+ end
+
def self.extended(klass)
klass.extend(ClassMethods)
diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb
index 8a61ee62a..4ca3240d4 100644
--- a/lib/puppet/network/formats.rb
+++ b/lib/puppet/network/formats.rb
@@ -1,6 +1,6 @@
require 'puppet/network/format_handler'
-Puppet::Network::FormatHandler.create(:yaml, :mime => "text/yaml") do
+Puppet::Network::FormatHandler.create_serialized_formats(:yaml) do
# Yaml doesn't need the class name; it's serialized.
def intern(klass, text)
YAML.load(text)
@@ -29,7 +29,7 @@ end
# This is a "special" format which is used for the moment only when sending facts
# as REST GET parameters (see Puppet::Configurer::FactHandler).
# This format combines a yaml serialization, then zlib compression and base64 encoding.
-Puppet::Network::FormatHandler.create(:b64_zlib_yaml, :mime => "text/b64_zlib_yaml") do
+Puppet::Network::FormatHandler.create_serialized_formats(:b64_zlib_yaml) do
require 'base64'
def use_zlib?
@@ -127,7 +127,7 @@ Puppet::Network::FormatHandler.create(:raw, :mime => "application/x-raw", :weigh
end
end
-Puppet::Network::FormatHandler.create(:pson, :mime => "text/pson", :weight => 10, :required_methods => [:render_method, :intern_method]) do
+Puppet::Network::FormatHandler.create_serialized_formats(:pson, :weight => 10, :required_methods => [:render_method, :intern_method]) do
confine :true => Puppet.features.pson?
def intern(klass, text)
@@ -159,4 +159,4 @@ Puppet::Network::FormatHandler.create(:pson, :mime => "text/pson", :weight => 10
end
# This is really only ever going to be used for Catalogs.
-Puppet::Network::FormatHandler.create(:dot, :mime => "text/dot", :required_methods => [:render_method])
+Puppet::Network::FormatHandler.create_serialized_formats(:dot, :required_methods => [:render_method])