summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions/extlookup.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions/extlookup.rb')
-rw-r--r--lib/puppet/parser/functions/extlookup.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/puppet/parser/functions/extlookup.rb b/lib/puppet/parser/functions/extlookup.rb
index ee230e7ce..177d9aef8 100644
--- a/lib/puppet/parser/functions/extlookup.rb
+++ b/lib/puppet/parser/functions/extlookup.rb
@@ -99,19 +99,15 @@ module Puppet::Parser::Functions
# this will result in /path/to/extdata/hosts/your.box.com.csv
# being searched.
#
- # we parse the precedence here because the best place to specify
- # it would be in site.pp but site.pp is only evaluated at startup
- # so $fqdn etc would have no meaning there, this way it gets evaluated
- # each run and has access to the right variables for that run
- lookupvar('extlookup_precedence').each do |prec|
- while prec =~ /%\{(.+?)\}/
- prec.gsub!(/%\{#{$1}\}/, lookupvar($1))
+ # This is for back compatibility to interpolate variables with %.
+ # % interpolation is a workaround for a problem that has been fixed: Puppet variable
+ # interpolation at top scope used to only happen on each run
+ extlookup_precedence = lookupvar('extlookup_precedence').collect do |var|
+ var.gsub(/%\{(.+?)\}/) do |capture|
+ lookupvar($1)
end
-
- extlookup_precedence << prec
end
-
datafiles = Array.new
# if we got a custom data file, put it first in the array of search files