+1, mostly

This also allows us to remove the 'to_yaml_properties' methods I've  
defined on various classes, so it's probably a good idea if those  
methods were removed.

On Apr 25, 2009, at 7:24 PM, Brice Figureau wrote:

>
> This is really much an hack.
>
> Code can be found in wip/yaml-fixup branch of my github repository.
>
> Signed-off-by: Brice Figureau <[email protected]>
> ---
> lib/puppet/network/formats.rb |    7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/lib/puppet/network/formats.rb b/lib/puppet/network/ 
> formats.rb
> index 85e8ce6..8ab9bc5 100644
> --- a/lib/puppet/network/formats.rb
> +++ b/lib/puppet/network/formats.rb
> @@ -12,7 +12,12 @@  
> Puppet::Network::FormatHandler.create(:yaml, :mime => "text/yaml") do
>     end
>
>     def render(instance)
> -        instance.to_yaml
> +        yaml = instance.to_yaml
> +
> +        # fixup invalid yaml as per:
> +        # http://redmine.ruby-lang.org/issues/show/1331
> +        yaml.gsub!(/((?:&id\d+\s+)?!ruby\/object:.*?)\s*\?/) { "?  
> #{$1}" } unless yaml.nil?
> +        yaml
>     end
>
>     # Yaml monkey-patches Array, so this works.
> -- 
> 1.6.0.2
>
>
> >


-- 
A computer lets you make more mistakes faster than any invention in
human history--with the possible exceptions of handguns and tequila.
     -- Mitch Ratcliffe
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to