summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-10 16:30:20 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-11 09:27:33 -0700
commita2115afbe2a5ab83ea5c84896492eaaf62a33507 (patch)
treee86030a4f4836ac964f60a48031963d5c796c97d
parentfe4dcd8b5985084462f1ee6e5e9887a8975bf18e (diff)
downloadpuppet-a2115afbe2a5ab83ea5c84896492eaaf62a33507.tar.gz
puppet-a2115afbe2a5ab83ea5c84896492eaaf62a33507.tar.xz
puppet-a2115afbe2a5ab83ea5c84896492eaaf62a33507.zip
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.
-rw-r--r--lib/puppet/node/environment.rb7
1 files changed, 7 insertions, 0 deletions
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}/