From a2115afbe2a5ab83ea5c84896492eaaf62a33507 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sat, 10 Jul 2010 16:30:20 -0700 Subject: Alt fix for #4207 -- serialize environments as their names 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. --- lib/puppet/node/environment.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb index 44c764025..762599cff 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}/ -- cgit