diff options
author | Luke Kanies <luke@madstop.com> | 2007-08-24 19:19:44 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-08-24 19:19:44 -0500 |
commit | ab5418390e3e49ce3a12b60902f405db157ed45b (patch) | |
tree | 897566c79345a1d9f6ce42b905cba42026fc5187 /lib | |
parent | c6e201cdd4ca5ee11a04cac77bf32faf40640b6d (diff) | |
download | puppet-ab5418390e3e49ce3a12b60902f405db157ed45b.tar.gz puppet-ab5418390e3e49ce3a12b60902f405db157ed45b.tar.xz puppet-ab5418390e3e49ce3a12b60902f405db157ed45b.zip |
The config class now has support for add an environment to its search path. Now I just need to go through the whole system and use the search path in addition to the parameter name itself.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/util/config.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/puppet/util/config.rb b/lib/puppet/util/config.rb index 27004cf41..796529f32 100644 --- a/lib/puppet/util/config.rb +++ b/lib/puppet/util/config.rb @@ -447,13 +447,11 @@ class Puppet::Util::Config # The order in which to search for values. def searchpath(environment = nil) - # Start with a stupid list. - [:cache, :cli, :memory, :name, :main] -# unless @searchpath -# @searchpath = [:cache, :memory, :cli, :name, :main].collect do |source| -# end -# end -# @searchpath + if environment + [:cache, :cli, :memory, environment, :name, :main] + else + [:cache, :cli, :memory, :name, :main] + end end # Get a list of objects per section @@ -720,8 +718,11 @@ Generated on #{Time.now}. @config.has_key?(param) end + # Find the correct value using our search path. Optionally accept an environment + # in which to search before the other configuration sections. def value(param, environment = nil) param = symbolize(param) + environment = symbolize(environment) if environment # Short circuit to nil for undefined parameters. return nil unless @config.include?(param) |