diff options
| author | Max Martin <max@puppetlabs.com> | 2011-03-15 16:12:49 -0700 |
|---|---|---|
| committer | Max Martin <max@puppetlabs.com> | 2011-03-15 16:12:49 -0700 |
| commit | 4c9bd43bc2f5fde9d86196e8689dced929d39aad (patch) | |
| tree | 2fa66f45306be3dfa1f37564a686e0f49d23b7be /lib/puppet | |
| parent | 9016662cc108dbcced5ad9c9a33f4ecd61cac178 (diff) | |
| parent | 25926d1922a9b75bc87ed7feed30693a69cdea9a (diff) | |
| download | puppet-4c9bd43bc2f5fde9d86196e8689dced929d39aad.tar.gz puppet-4c9bd43bc2f5fde9d86196e8689dced929d39aad.tar.xz puppet-4c9bd43bc2f5fde9d86196e8689dced929d39aad.zip | |
Merge branch 'ticket/2.6.next/6723-withenv-bug' into 2.6.next
* ticket/2.6.next/6723-withenv-bug:
(#6723) Fix withenv environment restoration bug
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/util/execution.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/puppet/util/execution.rb b/lib/puppet/util/execution.rb index dd820f856..69f4f2c15 100644 --- a/lib/puppet/util/execution.rb +++ b/lib/puppet/util/execution.rb @@ -4,16 +4,15 @@ module Puppet::Util::Execution # Run some code with a specific environment. Resets the environment back to # what it was at the end of the code. def withenv(hash) - oldvals = {} + saved = ENV.to_hash hash.each do |name, val| - name = name.to_s - oldvals[name] = ENV[name] - ENV[name] = val + ENV[name.to_s] = val end yield ensure - oldvals.each do |name, val| + ENV.clear + saved.each do |name, val| ENV[name] = val end end |
