diff options
| author | Markus Roberts <Markus@reality.com> | 2010-06-14 18:22:40 -0700 |
|---|---|---|
| committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
| commit | 4627b8fe11dc14bf42e98b84121b885df73c709e (patch) | |
| tree | e9eb82faeac31255d9c00f057d7dd4c9e4126e89 /lib/puppet/node/environment.rb | |
| parent | ccc869ea48397235d7ba2a5695424eee4923cb9d (diff) | |
| download | puppet-4627b8fe11dc14bf42e98b84121b885df73c709e.tar.gz puppet-4627b8fe11dc14bf42e98b84121b885df73c709e.tar.xz puppet-4627b8fe11dc14bf42e98b84121b885df73c709e.zip | |
Improving fix for #1175; tightening thread safety
The previous code maintained thread safety up to work-duplication (so that a
collision would, at worse, result in effective cache flushing and cause some
additional work to be done). The preceding patch addressed the single thread
issue of environment specific functions; this patch brings the thread safety
up to the previous standard.
Diffstat (limited to 'lib/puppet/node/environment.rb')
| -rw-r--r-- | lib/puppet/node/environment.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/puppet/node/environment.rb b/lib/puppet/node/environment.rb index 4363eea41..81f8f2cfe 100644 --- a/lib/puppet/node/environment.rb +++ b/lib/puppet/node/environment.rb @@ -42,15 +42,15 @@ class Puppet::Node::Environment end def self.current - @current || root + Thread.current[:environment] || root end def self.current=(env) - @current = new(env) + Thread.current[:environment] = new(env) end def self.root - @root ||= new(:'*root*') + @root end # This is only used for testing. @@ -128,4 +128,5 @@ class Puppet::Node::Environment end end + @root = new(:'*root*') end |
