If that wasn't obvious, this patch is to fix all the issues with ruby 
which is impossible to dump correctly in yaml hash keys when they are 
ruby objects.

On 25/04/09 19:24, 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.


-- 
Brice Figureau
Days of Wonder
http://www.daysofwonder.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