diff options
author | Markus Roberts <Markus@reality.com> | 2010-10-25 09:59:57 -0700 |
---|---|---|
committer | Nick Lewis <nick@puppetlabs.com> | 2011-04-12 12:47:32 -0700 |
commit | d0a56522f9c574b4a6db81caf4589175c901b09e (patch) | |
tree | 85459e783c7c2245a5b1189eeece36cfe4f4a4e3 /lib/puppet/parser | |
parent | 739260b28d7c09bacbb34cd4f4d4a32cfee01385 (diff) | |
download | puppet-d0a56522f9c574b4a6db81caf4589175c901b09e.tar.gz puppet-d0a56522f9c574b4a6db81caf4589175c901b09e.tar.xz puppet-d0a56522f9c574b4a6db81caf4589175c901b09e.zip |
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.
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/scope.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 |