Issue #6723 has been reported by Max Martin.

----------------------------------------
Bug #6723: Puppet::Util::Execution withenv method not resetting environment
https://projects.puppetlabs.com/issues/6723

Author: Max Martin
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


The withenv method in lib/puppet/util/execution is supposed to reset the 
environment to the state it was in before it was called, but it appears that it 
may not be doing this. A spec test written using this method was able to 
pollute the environment's PATH variable for all of the tests that ran after it. 
As is, there are no tests for this method. Tests should be added to check its 
behavior, and if it isn't correctly resetting the environment, it should be 
changed so that it does. Below is the test that caused the change to PATH:

    it "should warn if you're overriding path in environment" do        
         @provider.resource[:path] = ['/bogus/bin']
         @provider.resource[:environment] = ['PATH=/something/else']
        
           File.stubs(:exists?).returns(false)
           File.stubs(:exists?).with("foo").returns(true)
           File.stubs(:executable?).with("foo").returns(true)

           Puppet::Util.expects(:execute).with(['foo'], {:uid => nil, :gid => 
nil, :combine => true, :failonfail => false})
           @provider.run("foo")
        
          @logs.map {|l| "#{l.level}: #{l.message}" }.should == ["warning: 
Overriding environment setting 'PATH' with '/something/else'"]
        end



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to