diff options
author | Luke Kanies <luke@madstop.com> | 2008-10-02 23:07:19 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-10-03 14:15:22 +1000 |
commit | 7272d49149815e038c67b1ae645b449a1ec2578a (patch) | |
tree | d39725a51f07604e54b0231e577933db21a5d1fe /lib/puppet/util/settings.rb | |
parent | 1a9b5677de01fc1ed5a9a6ebbea99a73def7f689 (diff) | |
download | puppet-7272d49149815e038c67b1ae645b449a1ec2578a.tar.gz puppet-7272d49149815e038c67b1ae645b449a1ec2578a.tar.xz puppet-7272d49149815e038c67b1ae645b449a1ec2578a.zip |
Fixed #1613 - The client environment will be substituted when looking up settings.
This won't be perfect, because it still requires that the caller pass
in an environment, but for every case that an environment is passed in,
that environment will be substituted into settings when possible.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/util/settings.rb')
-rw-r--r-- | lib/puppet/util/settings.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index a8eb09049..1e49a3ada 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -114,12 +114,14 @@ class Puppet::Util::Settings end # Do variable interpolation on the value. - def convert(value) + def convert(value, environment = nil) return value unless value return value unless value.is_a? String newval = value.gsub(/\$(\w+)|\$\{(\w+)\}/) do |value| varname = $2 || $1 - if pval = self.value(varname) + if varname == "environment" and environment + environment + elsif pval = self.value(varname) pval else raise Puppet::DevError, "Could not find value for %s" % value @@ -781,7 +783,7 @@ Generated on #{Time.now}. val = @config[param].default if val.nil? # Convert it if necessary - val = convert(val) + val = convert(val, environment) # And cache it @cache[environment||"none"][param] = val |