summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/network')
-rw-r--r--lib/puppet/network/formats.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb
index 3a19b0bba..df6ef399c 100644
--- a/lib/puppet/network/formats.rb
+++ b/lib/puppet/network/formats.rb
@@ -26,9 +26,9 @@ Puppet::Network::FormatHandler.create(:yaml, :mime => "text/yaml") do
yaml
end
- # Everything's supported
+ # Everything's supported unless you're on 1.8.1
def supported?(klass)
- true
+ RUBY_VERSION != '1.8.1'
end
# fixup invalid yaml as per:
@@ -89,22 +89,22 @@ Puppet::Network::FormatHandler.create(:raw, :mime => "application/x-raw", :weigh
end
end
-Puppet::Network::FormatHandler.create(:json, :mime => "text/json", :weight => 10, :required_methods => [:render_method, :intern_method]) do
- confine :true => Puppet.features.json?
+Puppet::Network::FormatHandler.create(:pson, :mime => "text/pson", :weight => 10, :required_methods => [:render_method, :intern_method]) do
+ confine :true => Puppet.features.pson?
def intern(klass, text)
- data_to_instance(klass, JSON.parse(text))
+ data_to_instance(klass, PSON.parse(text))
end
def intern_multiple(klass, text)
- JSON.parse(text).collect do |data|
+ PSON.parse(text).collect do |data|
data_to_instance(klass, data)
end
end
- # JSON monkey-patches Array, so this works.
+ # PSON monkey-patches Array, so this works.
def render_multiple(instances)
- instances.to_json
+ instances.to_pson
end
# If they pass class information, we want to ignore it. By default,
@@ -118,6 +118,6 @@ Puppet::Network::FormatHandler.create(:json, :mime => "text/json", :weight => 10
if data.is_a?(klass)
return data
end
- klass.from_json(data)
+ klass.from_pson(data)
end
end