+1, my much preferred option.

-- 
Luke Kanies | +1-615-594-8199

On Jul 10, 2010, at 16:38, Markus Roberts <[email protected]> wrote:

> Environments contain a deal of transitory information and references to other
> objects, none of which is wanted when they are serialized.
>
> Rather than having this serialization concern propogate through the code by
> replacing environments by their names prior to serialization (which would be
> one way to address the problem) this patch changes environments so they only
> serialize their identity (name) and not their contents.
>
> Signed-off-by: Markus Roberts <[email protected]>
> ---
> lib/puppet/node/environment.rb |    7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb
> index 44c7640..762599c 100644
> --- a/lib/puppet/node/environment.rb
> +++ b/lib/puppet/node/environment.rb
> @@ -114,6 +114,13 @@ class Puppet::Node::Environment
>     name.to_s
>   end
>
> +  # The only thing we care about when serializing an environment is its
> +  # identity; everything else is ephemeral and should not be stored or
> +  # transmitted.
> +  def to_zaml(z)
> +    self.to_s.to_zaml(z)
> +  end
> +
>   def validate_dirs(dirs)
>     dirs.collect do |dir|
>       if dir !~ /^#{File::SEPARATOR}/
> --
> 1.6.4
>
> --
> 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.
>

-- 
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