summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions/extlookup.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-08-12 13:53:13 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-08-12 13:53:29 -0700
commit1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac (patch)
tree3c6495838d1b876528cb4522de3484c44749140d /lib/puppet/parser/functions/extlookup.rb
parentd5db8db116aff58215ab0feebd7ec02086040f51 (diff)
parent0f56c1b02d40f1f8552d933dd78b24745937b137 (diff)
downloadpuppet-1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac.tar.gz
puppet-1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac.tar.xz
puppet-1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac.zip
Merge branch 'next'
This synchronizes the 2.7 master branch with 2.6.1RC2
Diffstat (limited to 'lib/puppet/parser/functions/extlookup.rb')
-rw-r--r--lib/puppet/parser/functions/extlookup.rb19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/puppet/parser/functions/extlookup.rb b/lib/puppet/parser/functions/extlookup.rb
index ee230e7ce..a4786f5da 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
@@ -126,9 +122,6 @@ module Puppet::Parser::Functions
desired = nil
datafiles.each do |file|
- parser = Puppet::Parser::Parser.new(environment)
- parser.watch_file(file) if File.exists?(file)
-
if desired.nil?
if File.exists?(file)
result = CSV.read(file).find_all do |r|