summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/network')
-rw-r--r--lib/puppet/network/formats.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb
index 85e8ce6f8..51354b03d 100644
--- a/lib/puppet/network/formats.rb
+++ b/lib/puppet/network/formats.rb
@@ -12,18 +12,31 @@ Puppet::Network::FormatHandler.create(:yaml, :mime => "text/yaml") do
end
def render(instance)
- instance.to_yaml
+ yaml = instance.to_yaml
+
+ yaml = fixup(yaml) unless yaml.nil?
+ yaml
end
# Yaml monkey-patches Array, so this works.
def render_multiple(instances)
- instances.to_yaml
+ yaml = instances.to_yaml
+
+ yaml = fixup(yaml) unless yaml.nil?
+ yaml
end
# Everything's supported
def supported?(klass)
true
end
+
+ # fixup invalid yaml as per:
+ # http://redmine.ruby-lang.org/issues/show/1331
+ def fixup(yaml)
+ yaml.gsub!(/((?:&id\d+\s+)?!ruby\/object:.*?)\s*\?/) { "? #{$1}" }
+ yaml
+ end
end