diff options
-rw-r--r-- | lib/puppet/util/settings.rb | 8 | ||||
-rwxr-xr-x | spec/unit/util/settings.rb | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 625bab42a..3e3bc7f76 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -494,7 +494,15 @@ class Puppet::Util::Settings @sync.synchronize do # yay, thread-safe @values[type][param] = value @cache.clear + clearused + + # Clear the list of environments, because they cache, at least, the module path. + # We *could* preferentially just clear them if the modulepath is changed, + # but we don't really know if, say, the vardir is changed and the modulepath + # is defined relative to it. We need the defined? stuff because of loading + # order issues. + Puppet::Node::Environment.clear if defined?(Puppet::Node) and defined?(Puppet::Node::Environment) end return value 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 |