Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3597

Update documentation regarding throw :undefined_variable for Scope [] and lookupvar

    XMLWordPrintable

    Details

    • Template:
    • Team:
      Puppet Developer Experience
    • Story Points:
      1
    • Sprint:
      PDE 2017-05-31
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Documentation for Ruby method Scope#lookupvar updated to show that the symbol :undefined_variable is thrown if strict_variables is in effect and a variable is not found.
    • QA Risk Assessment:
      No Action

      Description

      Using lookupvar within a function is throwing an evaluation error and not properly throwing Puppet::Error
      Example usage STDLIB has_interface_with
      Error originates at Scope.variable_not_found

      Error: Evaluation Error: Error while evaluating a Function Call, uncaught throw :undefined_variable at /Users/travisfields/repos/puppetlabs/stdlib/network_test.pp:2:4 on node traviss-mbp.delivery.puppetlabs.net
      /Library/Ruby/Site/puppet/parser/scope.rb:405:in `throw'
      /Library/Ruby/Site/puppet/parser/scope.rb:405:in `variable_not_found'
      /Library/Ruby/Site/puppet/parser/scope.rb:397:in `lookupvar'
      /Users/travisfields/.puppet/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb:38:in `block in <module:Functions>'
      /Library/Ruby/Site/puppet/parser/functions.rb:164:in `block (2 levels) in newfunction'
      /Library/Ruby/Site/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /Library/Ruby/Site/puppet/util/profiler.rb:51:in `profile'
      /Library/Ruby/Site/puppet/parser/functions.rb:157:in `block in newfunction'
      /Users/travisfields/.puppet/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb:20:in `block in <module:Functions>'
      /Library/Ruby/Site/puppet/parser/functions.rb:164:in `block (2 levels) in newfunction'
      /Library/Ruby/Site/puppet/util/profiler/around_profiler.rb:58:in `profile'
      /Library/Ruby/Site/puppet/util/profiler.rb:51:in `profile'
      /Library/Ruby/Site/puppet/parser/functions.rb:157:in `block in newfunction'
      /Library/Ruby/Site/puppet/pops/evaluator/runtime3_support.rb:248:in `call_function'
      /Library/Ruby/Site/puppet/pops/evaluator/evaluator_impl.rb:785:in `eval_CallNamedFunctionExpression'
      /Library/Ruby/Site/puppet/pops/visitor.rb:43:in `block in visit_this'
      /Library/Ruby/Site/puppet/pops/visitor.rb:39:in `each'
      /Library/Ruby/Site/puppet/pops/visitor.rb:39:in `visit_this'
      /Library/Ruby/Site/puppet/pops/visitor.rb:66:in `visit_this_1'
      /Library/Ruby/Site/puppet/pops/evaluator/evaluator_impl.rb:77:in `evaluate'
      /Library/Ruby/Site/puppet/pops/evaluator/evaluator_impl.rb:857:in `block in eval_IfExpression'
      /Library/Ruby/Site/puppet/pops/evaluator/evaluator_impl.rb:1090:in `with_guarded_scope'
      /Library/Ruby/Site/puppet/pops/evaluator/evaluator_impl.rb:856:in `eval_IfExpression'
      /Library/Ruby/Site/puppet/pops/visitor.rb:43:in `block in visit_this'
      /Library/Ruby/Site/puppet/pops/visitor.rb:39:in `each'
      /Library/Ruby/Site/puppet/pops/visitor.rb:39:in `visit_this'
      /Library/Ruby/Site/puppet/pops/visitor.rb:66:in `visit_this_1'
      /Library/Ruby/Site/puppet/pops/evaluator/evaluator_impl.rb:77:in `evaluate'
      /Library/Ruby/Site/puppet/pops/evaluator/evaluator_impl.rb:521:in `block in eval_BlockExpression'
      /Library/Ruby/Site/puppet/pops/evaluator/evaluator_impl.rb:521:in `each'
      /Library/Ruby/Site/puppet/pops/evaluator/evaluator_impl.rb:521:in `eval_BlockExpression'
      /Library/Ruby/Site/puppet/pops/visitor.rb:43:in `block in visit_this'
      /Library/Ruby/Site/puppet/pops/visitor.rb:39:in `each'
      /Library/Ruby/Site/puppet/pops/visitor.rb:39:in `visit_this'
      /Library/Ruby/Site/puppet/pops/visitor.rb:66:in `visit_this_1'
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            travis Travis Fields
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support