From dd33eac61c4d0baed62eb88bb18dc59e474ba68d Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Oct 2010 12:48:50 -0700 Subject: Refactor prior to #5063 -- remove dead "topscope?" code The Scope#topscope? method was never called anywhere (including tests) and so far as I can tell was incorrect as the Scope#level is never being set. --- lib/puppet/parser/scope.rb | 5 ----- 1 file changed, 5 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 24f1d01f7..53289b87d 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -104,11 +104,6 @@ class Puppet::Parser::Scope compiler.environment end - # Are we the top scope? - def topscope? - @level == 1 - end - def find_hostclass(name) known_resource_types.find_hostclass(namespaces, name) end -- cgit From b3baee8c625d1a8d8fb8be20d1534ed71188a5f2 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Oct 2010 14:02:12 -0700 Subject: Refactor on the way to #5063 -- removing unused Scope#level This attribute is apparently no longer set or accessed. --- lib/puppet/parser/scope.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 53289b87d..07347552b 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -18,7 +18,7 @@ class Puppet::Parser::Scope include Enumerable include Puppet::Util::Errors - attr_accessor :level, :source, :resource + attr_accessor :source, :resource attr_accessor :base, :keyword attr_accessor :top, :translated, :compiler attr_accessor :parent @@ -318,8 +318,6 @@ class Puppet::Parser::Scope # to be reassigned. def setvar(name,value, options = {}) table = options[:ephemeral] ? @ephemeral.last : @symtable - #Puppet.debug "Setting %s to '%s' at level %s mode append %s" % - # [name.inspect,value,self.level, append] if table.include?(name) unless options[:append] error = Puppet::ParseError.new("Cannot reassign variable #{name}") -- cgit From d5dc3036eda210f318160e2442f7b65e0995ee23 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Oct 2010 14:23:32 -0700 Subject: Fix for #5063 -- explicitly scope internal variable lookups When we lookup a global variable / fact from code we should explicitly look in the global scope. --- lib/puppet/parser/functions/extlookup.rb | 9 ++------- lib/puppet/parser/functions/fqdn_rand.rb | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/functions/extlookup.rb b/lib/puppet/parser/functions/extlookup.rb index bc55410b9..b5688d644 100644 --- a/lib/puppet/parser/functions/extlookup.rb +++ b/lib/puppet/parser/functions/extlookup.rb @@ -91,14 +91,9 @@ This is for back compatibility to interpolate variables with %. % interpolation raise Puppet::ParseError, ("extlookup(): wrong number of arguments (#{args.length}; must be <= 3)") if args.length > 3 - extlookup_datadir = lookupvar('extlookup_datadir') - extlookup_precedence = Array.new + extlookup_datadir = lookupvar('::extlookup_datadir') - extlookup_precedence = lookupvar('extlookup_precedence').collect do |var| - var.gsub(/%\{(.+?)\}/) do |capture| - lookupvar($1) - end - end + extlookup_precedence = lookupvar('::extlookup_precedence').collect { |var| var.gsub(/%\{(.+?)\}/) { lookupvar("::#{$1}") } } datafiles = Array.new diff --git a/lib/puppet/parser/functions/fqdn_rand.rb b/lib/puppet/parser/functions/fqdn_rand.rb index 91157a148..93ab98bcd 100644 --- a/lib/puppet/parser/functions/fqdn_rand.rb +++ b/lib/puppet/parser/functions/fqdn_rand.rb @@ -7,6 +7,6 @@ Puppet::Parser::Functions::newfunction(:fqdn_rand, :type => :rvalue, :doc => $random_number_seed = fqdn_rand(30,30)") do |args| require 'digest/md5' max = args.shift - srand(Digest::MD5.hexdigest([lookupvar('fqdn'),args].join(':')).hex) + srand(Digest::MD5.hexdigest([lookupvar('::fqdn'),args].join(':')).hex) rand(max).to_s end -- cgit From 31f8e660c8f4c0ec01f140322cf7c585144a0888 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Oct 2010 17:24:09 -0700 Subject: Refactor en route to #5027 -- remove usestring parameter from lookupvar The usestring parameter to lookupvar was objectionable for several reasons; first, it performed a function orthogonal to the main purpose of the method, second its default was the least common value, and third it was causing other code to work for reasons that were not obvious (extlookup). This refactor breaks the value-transforming function out into a seperate method which allows the user to specify the value to be used in lieu of :undef and removes the parameter. The function, Scope#undef_as(default,exp) is written so that it can be used in user code (templates, functions, etc.) if needed. This refactor will introduce a user-visible behaviour change in the case where users were counting on lookupvar to return "" for undefined variables. The best solution is to have them use undef_as, replacing: lookupvar('myvar') with undef_as('',lookupvar('myvar')) (with the option to specify another default value if desired). If this is too objectionable, we could rename the existing lookupvar as raw_lookupvar and define def lookupvar(v) undef_as('',raw_lookupvar(v)) end to restore the present behaviour. --- lib/puppet/parser/ast/leaf.rb | 2 +- lib/puppet/parser/functions/extlookup.rb | 4 +-- lib/puppet/parser/resource.rb | 2 +- lib/puppet/parser/scope.rb | 42 +++++++++++++++----------------- lib/puppet/parser/templatewrapper.rb | 10 ++------ 5 files changed, 25 insertions(+), 35 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb index 77617e992..b61634d6c 100644 --- a/lib/puppet/parser/ast/leaf.rb +++ b/lib/puppet/parser/ast/leaf.rb @@ -124,7 +124,7 @@ class Puppet::Parser::AST # not include syntactical constructs, like '$' and '{}'). def evaluate(scope) parsewrap do - if (var = scope.lookupvar(@value, false)) == :undefined + if (var = scope.lookupvar(@value)) == :undefined var = :undef end var diff --git a/lib/puppet/parser/functions/extlookup.rb b/lib/puppet/parser/functions/extlookup.rb index b5688d644..5fbf26cec 100644 --- a/lib/puppet/parser/functions/extlookup.rb +++ b/lib/puppet/parser/functions/extlookup.rb @@ -91,9 +91,9 @@ This is for back compatibility to interpolate variables with %. % interpolation raise Puppet::ParseError, ("extlookup(): wrong number of arguments (#{args.length}; must be <= 3)") if args.length > 3 - extlookup_datadir = lookupvar('::extlookup_datadir') + extlookup_datadir = undef_as('',lookupvar('::extlookup_datadir')) - extlookup_precedence = lookupvar('::extlookup_precedence').collect { |var| var.gsub(/%\{(.+?)\}/) { lookupvar("::#{$1}") } } + extlookup_precedence = undef_as([],lookupvar('::extlookup_precedence')).collect { |var| var.gsub(/%\{(.+?)\}/) { lookupvar("::#{$1}") } } datafiles = Array.new diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index c007d4dbe..ace01bb4b 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -241,7 +241,7 @@ class Puppet::Parser::Resource < Puppet::Resource def add_backward_compatible_relationship_param(name) # Skip metaparams for which we get no value. - return unless val = scope.lookupvar(name.to_s, false) and val != :undefined + return unless val = scope.lookupvar(name.to_s) and val != :undefined # The default case: just set the value set_parameter(name, val) and return unless @parameters[name] diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 07347552b..df307915e 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -210,45 +210,41 @@ class Puppet::Parser::Scope find_definition(name) || find_hostclass(name) end - def lookup_qualified_var(name, usestring) + def undef_as(x,v) + (v == :undefined) ? x : (v == :undef) ? x : v + end + + def lookup_qualified_var(name) parts = name.split(/::/) shortname = parts.pop klassname = parts.join("::") klass = find_hostclass(klassname) unless klass warning "Could not look up qualified variable '#{name}'; class #{klassname} could not be found" - return usestring ? "" : :undefined + return :undefined end unless kscope = class_scope(klass) warning "Could not look up qualified variable '#{name}'; class #{klassname} has not been evaluated" - return usestring ? "" : :undefined + return :undefined end - kscope.lookupvar(shortname, usestring) + kscope.lookupvar(shortname) end private :lookup_qualified_var - # Look up a variable. The simplest value search we do. Default to returning - # an empty string for missing values, but support returning a constant. - def lookupvar(name, usestring = true) + # Look up a variable. The simplest value search we do. + def lookupvar(name) table = ephemeral?(name) ? @ephemeral.last : @symtable # If the variable is qualified, then find the specified scope and look the variable up there instead. if name =~ /::/ - return lookup_qualified_var(name, usestring) - end - # We can't use "if table[name]" here because the value might be false - if ephemeral_include?(name) or table.include?(name) - if usestring and table[name] == :undef - return "" - else - return table[name] - end - elsif self.parent - return parent.lookupvar(name, usestring) - elsif usestring - return "" + lookup_qualified_var(name) + elsif ephemeral_include?(name) or table.include?(name) + # We can't use "if table[name]" here because the value might be false + table[name] + elsif parent + parent.lookupvar(name) else - return :undefined + :undefined end end @@ -333,7 +329,7 @@ class Puppet::Parser::Scope table[name] = value else # append case # lookup the value in the scope if it exists and insert the var - table[name] = lookupvar(name) + table[name] = undef_as('',lookupvar(name)) # concatenate if string, append if array, nothing for other types case value when Array @@ -363,7 +359,7 @@ class Puppet::Parser::Scope if var and var =~ /^[0-9]+$/ and not ephemeral_include?(var) next end - out << lookupvar(var).to_s || "" + out << undef_as('',lookupvar(var)).to_s end elsif ss.scan(/^\\(.)/) # Puppet.debug("Got escape: pos:%d; m:%s" % [ss.pos, ss.matched]) diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb index 6864aa1a9..73fcb8aac 100644 --- a/lib/puppet/parser/templatewrapper.rb +++ b/lib/puppet/parser/templatewrapper.rb @@ -20,11 +20,7 @@ class Puppet::Parser::TemplateWrapper # Should return true if a variable is defined, false if it is not def has_variable?(name) - if scope.lookupvar(name.to_s, false) != :undefined - true - else - false - end + scope.lookupvar(name.to_s) != :undefined end # Allow templates to access the defined classes @@ -55,9 +51,7 @@ class Puppet::Parser::TemplateWrapper # the missing_method definition here until we declare the syntax finally # dead. def method_missing(name, *args) - # We have to tell lookupvar to return :undefined to us when - # appropriate; otherwise it converts to "". - value = scope.lookupvar(name.to_s, false) + value = scope.lookupvar(name.to_s) if value != :undefined return value else -- cgit From 1954bbfe175ae7f18316e57af43362eb4ed73553 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Thu, 21 Oct 2010 20:39:33 -0700 Subject: Refactor on the road to #5027 -- remove unused Scope#strinterp One of the uses of lookupvar was in the method Scope#strinterp; this method is no longer used (string interpolation is now handled by the parser (for the syntax) and AST nodes (for the semantics)) so this use of lookupvar can be excised, along with a fair amount of surrounding code. --- lib/puppet/parser/scope.rb | 59 ---------------------------------------------- 1 file changed, 59 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index df307915e..77032992c 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -343,65 +343,6 @@ class Puppet::Parser::Scope end end - # Return an interpolated string. - def strinterp(string, file = nil, line = nil) - # Most strings won't have variables in them. - ss = StringScanner.new(string) - out = "" - while not ss.eos? - if ss.scan(/^\$\{((\w*::)*\w+|[0-9]+)\}|^\$([0-9])|^\$((\w*::)*\w+)/) - # If it matches the backslash, then just retun the dollar sign. - if ss.matched == '\\$' - out << '$' - else # look the variable up - # make sure $0-$9 are lookupable only if ephemeral - var = ss[1] || ss[3] || ss[4] - if var and var =~ /^[0-9]+$/ and not ephemeral_include?(var) - next - end - out << undef_as('',lookupvar(var)).to_s - end - elsif ss.scan(/^\\(.)/) - # Puppet.debug("Got escape: pos:%d; m:%s" % [ss.pos, ss.matched]) - case ss[1] - when 'n' - out << "\n" - when 't' - out << "\t" - when 's' - out << " " - when '\\' - out << '\\' - when '$' - out << '$' - else - str = "Unrecognised escape sequence '#{ss.matched}'" - str += " in file #{file}" if file - str += " at line #{line}" if line - Puppet.warning str - out << ss.matched - end - elsif ss.scan(/^\$/) - out << '$' - elsif ss.scan(/^\\\n/) # an escaped carriage return - next - else - tmp = ss.scan(/[^\\$]+/) - # Puppet.debug("Got other: pos:%d; m:%s" % [ss.pos, tmp]) - unless tmp - error = Puppet::ParseError.new("Could not parse string #{string.inspect}") - {:file= => file, :line= => line}.each do |m,v| - error.send(m, v) if v - end - raise error - end - out << tmp - end - end - - out - end - # Return the tags associated with this scope. It's basically # just our parents' tags, plus our type. We don't cache this value # because our parent tags might change between calls. -- cgit From 10230cfc28e77dde127c157b7238fee2fc378969 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sun, 24 Oct 2010 14:08:14 -0700 Subject: Step towards #5027 -- scopes should know if they are dynamic The logic for distinguishing dynamic / static scopes was borrowed from Nick & Paul's patch, the main differences here being 1) calling it "dynamic" (true/ false) rather than "parent_relationship" (:inherited/:dynamic) 2) aligning the default so that it only needs to get set in one place (the one that will eventually go away) and 3) setting it on createion rather than with a setter. Setting it in one place, on creation, also makes it easier to see that anytime we access a scope it will have the correct setting of Scope#dynamic and that this does not change. This commit also contains a minor refactor (removing Type#subscope) that is not strictly tied to the main purpose but lies in the direction we are needing to go and it simplified things to do it now. --- lib/puppet/parser/scope.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 77032992c..f7a0134fc 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -21,7 +21,7 @@ class Puppet::Parser::Scope attr_accessor :source, :resource attr_accessor :base, :keyword attr_accessor :top, :translated, :compiler - attr_accessor :parent + attr_accessor :parent, :dynamic attr_reader :namespaces # thin wrapper around an ephemeral -- cgit From d7201ed38929f867d31bc9b916e90679606dc9f8 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sun, 24 Oct 2010 15:37:31 -0700 Subject: Refactor for 5027 -- get rid of lookup_qualified_var Scope#lookup_qualified_var was a "magic bag" that took a qualified variable name apart and called back in to lookupvar with a new scope. This commit is a semantically neutral refactor that replaces it with a function to find the desired scope as a pure function (with error detection). --- lib/puppet/parser/scope.rb | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index f7a0134fc..95b765b52 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -214,30 +214,25 @@ class Puppet::Parser::Scope (v == :undefined) ? x : (v == :undef) ? x : v end - def lookup_qualified_var(name) - parts = name.split(/::/) - shortname = parts.pop - klassname = parts.join("::") - klass = find_hostclass(klassname) - unless klass - warning "Could not look up qualified variable '#{name}'; class #{klassname} could not be found" - return :undefined - end - unless kscope = class_scope(klass) - warning "Could not look up qualified variable '#{name}'; class #{klassname} has not been evaluated" - return :undefined - end - kscope.lookupvar(shortname) + def qualified_scope(classname) + raise "class #{classname} could not be found" unless klass = find_hostclass(classname) + raise "class #{classname} has not been evaluated" unless kscope = class_scope(klass) + kscope end - private :lookup_qualified_var + private :qualified_scope # Look up a variable. The simplest value search we do. def lookupvar(name) table = ephemeral?(name) ? @ephemeral.last : @symtable # If the variable is qualified, then find the specified scope and look the variable up there instead. - if name =~ /::/ - lookup_qualified_var(name) + if name =~ /^(.*)::(.+)$/ + begin + qualified_scope($1).lookupvar($2) + rescue RuntimeError => e + warning "Could not look up qualified variable '#{name}'; #{e.message}" + :undefined + end elsif ephemeral_include?(name) or table.include?(name) # We can't use "if table[name]" here because the value might be false table[name] -- cgit From 739260b28d7c09bacbb34cd4f4d4a32cfee01385 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sun, 24 Oct 2010 23:29:38 -0700 Subject: Towards 5027 -- add options hash to lookupvar as with setvar This patch adds an options hash to lookupvar analogous to the one taken by setvar and uses it to pass in source location for error reporting. It also fixes the mechanism used by setvar (file was not being passed correctly), adds line and file information to errors in templates, and extends/corrects tests. As presently written it does not gather userful line numbers from inline templates and there are no tests for the template line number generation. --- lib/puppet/parser/ast/leaf.rb | 4 ++-- lib/puppet/parser/ast/vardef.rb | 2 +- lib/puppet/parser/scope.rb | 9 +++++---- lib/puppet/parser/templatewrapper.rb | 12 +++++++++--- 4 files changed, 17 insertions(+), 10 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb index b61634d6c..c8ebc9483 100644 --- a/lib/puppet/parser/ast/leaf.rb +++ b/lib/puppet/parser/ast/leaf.rb @@ -124,7 +124,7 @@ class Puppet::Parser::AST # not include syntactical constructs, like '$' and '{}'). def evaluate(scope) parsewrap do - if (var = scope.lookupvar(@value)) == :undefined + if (var = scope.lookupvar(@value, :file => file, :line => line)) == :undefined var = :undef end var @@ -141,7 +141,7 @@ class Puppet::Parser::AST def evaluate_container(scope) container = variable.respond_to?(:evaluate) ? variable.safeevaluate(scope) : variable - (container.is_a?(Hash) or container.is_a?(Array)) ? container : scope.lookupvar(container) + (container.is_a?(Hash) or container.is_a?(Array)) ? container : scope.lookupvar(container, :file => file, :line => line) end def evaluate_key(scope) diff --git a/lib/puppet/parser/ast/vardef.rb b/lib/puppet/parser/ast/vardef.rb index 6de1860c8..b766311dd 100644 --- a/lib/puppet/parser/ast/vardef.rb +++ b/lib/puppet/parser/ast/vardef.rb @@ -20,7 +20,7 @@ class Puppet::Parser::AST name = @name.safeevaluate(scope) parsewrap do - scope.setvar(name,value, :file => @file, :line => @line, :append => @append) + scope.setvar(name,value, :file => file, :line => line, :append => @append) end end end diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 95b765b52..a61a8578f 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -223,21 +223,22 @@ class Puppet::Parser::Scope private :qualified_scope # Look up a variable. The simplest value search we do. - def lookupvar(name) + def lookupvar(name, options = {}) table = ephemeral?(name) ? @ephemeral.last : @symtable # If the variable is qualified, then find the specified scope and look the variable up there instead. if name =~ /^(.*)::(.+)$/ begin - qualified_scope($1).lookupvar($2) + qualified_scope($1).lookupvar($2,options) rescue RuntimeError => e - warning "Could not look up qualified variable '#{name}'; #{e.message}" + location = (options[:file] && options[:line]) ? " at #{options[:file]}:#{options[:line]}" : '' + warning "Could not look up qualified variable '#{name}'; #{e.message}#{location}" :undefined end elsif ephemeral_include?(name) or table.include?(name) # We can't use "if table[name]" here because the value might be false table[name] elsif parent - parent.lookupvar(name) + parent.lookupvar(name,options) else :undefined end diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb index 73fcb8aac..180a03dc9 100644 --- a/lib/puppet/parser/templatewrapper.rb +++ b/lib/puppet/parser/templatewrapper.rb @@ -18,9 +18,14 @@ class Puppet::Parser::TemplateWrapper @__scope__ end + def script_line + # find which line in the template (if any) we were called from + caller.find { |l| l =~ /#{file}:/ }.first[/:(\d+):/,1] + end + # Should return true if a variable is defined, false if it is not def has_variable?(name) - scope.lookupvar(name.to_s) != :undefined + scope.lookupvar(name.to_s, :file => file, :line => script_line) != :undefined end # Allow templates to access the defined classes @@ -51,13 +56,13 @@ class Puppet::Parser::TemplateWrapper # the missing_method definition here until we declare the syntax finally # dead. def method_missing(name, *args) - value = scope.lookupvar(name.to_s) + value = scope.lookupvar(name.to_s,:file => file,:line => script_line) if value != :undefined return value else # Just throw an error immediately, instead of searching for # other missingmethod things or whatever. - raise Puppet::ParseError, "Could not find value for '#{name}'" + raise Puppet::ParseError.new("Could not find value for '#{name}'",@file,script_line) end end @@ -97,6 +102,7 @@ class Puppet::Parser::TemplateWrapper result = nil benchmark(:debug, "Interpolated template #{template_source}") do template = ERB.new(self.string, 0, "-") + template.filename = file result = template.result(binding) end -- cgit 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/puppet/parser') 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 From f6fb193078c497476326ee80827e1585ae26603c Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Tue, 12 Apr 2011 13:05:54 -0700 Subject: (#5027) Spell deprecation correctly Paired-With: Jesse Wolfe --- lib/puppet/parser/scope.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index dba94407e..8de9d60b1 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -238,7 +238,7 @@ class Puppet::Parser::Scope # 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." + Puppet.deprecation_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 -- cgit