From d0a56522f9c574b4a6db81caf4589175c901b09e Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Mon, 25 Oct 2010 09:59:57 -0700 Subject: Fix for #5027 -- generate a deprication warning for dynamic lookup This fix implements the same logic as Nick & Paul's patch in a different way. There aren't any tests yet and I'm still working out if I agree with the handling of some edge cases, so this should be considered premliminary. --- lib/puppet/parser/scope.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index a61a8578f..dba94407e 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -236,9 +236,13 @@ class Puppet::Parser::Scope end elsif ephemeral_include?(name) or table.include?(name) # We can't use "if table[name]" here because the value might be false + if options[:dynamic] and self != compiler.topscope + location = (options[:file] && options[:line]) ? " at #{options[:file]}:#{options[:line]}" : '' + Puppet.deprication_warning "Dynamic lookup of $#{name}#{location} will not be supported in future versions. Use a fully-qualified variable name or parameterized classes." + end table[name] elsif parent - parent.lookupvar(name,options) + parent.lookupvar(name,options.merge(:dynamic => (dynamic || options[:dynamic]))) else :undefined end -- cgit