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 /lib | |
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 'lib')
-rw-r--r-- | lib/puppet/util/settings.rb | 8 |
1 files changed, 8 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 |