diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2010-05-25 15:13:28 -0700 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | dc1a977512b854c967bfcb1d115d88c6f778e56e (patch) | |
| tree | bdf3221f64c9492fd571c376993d64b0dc7370ca /lib/puppet/network | |
| parent | e0e6b642c4eefc1b5f44b44638d2db24f4845ef1 (diff) | |
| download | puppet-dc1a977512b854c967bfcb1d115d88c6f778e56e.tar.gz puppet-dc1a977512b854c967bfcb1d115d88c6f778e56e.tar.xz puppet-dc1a977512b854c967bfcb1d115d88c6f778e56e.zip | |
[#3766] Remove YAML fixups
Remove workarounds that were only needed because ruby's builtin YAML
lib is broken.
Diffstat (limited to 'lib/puppet/network')
| -rw-r--r-- | lib/puppet/network/formats.rb | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/formats.rb index 92f778c70..eec632d72 100644 --- a/lib/puppet/network/formats.rb +++ b/lib/puppet/network/formats.rb @@ -12,30 +12,17 @@ Puppet::Network::FormatHandler.create(:yaml, :mime => "text/yaml") do end def render(instance) - yaml = instance.to_yaml - - yaml = fixup(yaml) unless yaml.nil? - yaml + instance.to_yaml end # Yaml monkey-patches Array, so this works. def render_multiple(instances) - yaml = instances.to_yaml - - yaml = fixup(yaml) unless yaml.nil? - yaml + instances.to_yaml end - # Everything's supported unless you're on 1.8.1 + # Unlike core's yaml, ZAML should support 1.8.1 just fine def supported?(klass) - RUBY_VERSION != '1.8.1' - 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 + true end end @@ -66,29 +53,15 @@ Puppet::Network::FormatHandler.create(:b64_zlib_yaml, :mime => "text/b64_zlib_ya end def render(instance) - yaml = instance.to_yaml - - yaml = encode(fixup(yaml)) unless yaml.nil? - yaml + encode(instance.to_yaml) end def render_multiple(instances) - yaml = instances.to_yaml - - yaml = encode(fixup(yaml)) unless yaml.nil? - yaml + encode(instances.to_yaml) end - # Because of yaml issue in ruby 1.8.1... def supported?(klass) - RUBY_VERSION != '1.8.1' and use_zlib? - 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 + true end def encode(text) |
