diff options
author | Luke Kanies <luke@madstop.com> | 2009-09-03 17:41:42 -0700 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-09-03 17:41:42 -0700 |
commit | ea5847875b5fd7e2d13470d9e74bb0f671ee4d95 (patch) | |
tree | 2fe7350fa04435bd98c4fa01b1def2de8c7729ca /spec | |
parent | 1a3d0c876121561173c485b2e4d0dd7131f43eab (diff) | |
download | puppet-ea5847875b5fd7e2d13470d9e74bb0f671ee4d95.tar.gz puppet-ea5847875b5fd7e2d13470d9e74bb0f671ee4d95.tar.xz puppet-ea5847875b5fd7e2d13470d9e74bb0f671ee4d95.zip |
Fixing #2590 - modulepath is not cached inappropriately
It was getting cached by Environment instances too early, thus causing some
executables to use the default even when it was overridden.
We're taking the slightly extreme step of clearing the environment
list if any parameter is set, but this is relatively inexpensive and
is the only way to always be correct.
The reason that the environments cache this value at all is that to build
up their module path they have to search through every known module for a lib
or plugins directory, which is then done every time a class is sought in
the language. Caching it saves a *ton* of file accesses.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/util/settings.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb index c00ca5881..ae8aaac8a 100755 --- a/spec/unit/util/settings.rb +++ b/spec/unit/util/settings.rb @@ -171,6 +171,11 @@ describe Puppet::Util::Settings do @settings[:myval] = "memarg" @settings[:myval].should == "cliarg" end + + it "should clear the list of environments" do + Puppet::Node::Environment.expects(:clear).at_least(1) + @settings[:myval] = "memarg" + end end describe "when returning values" do |