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

Legacy function error does not include the source ref

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • PUP 6.28.0, PUP 7.17.0
    • None
    • Phoenix
    • 2
    • Phoenix 2022-05-11
    • Needs Assessment
    • lollipopman
    • Enhancement
    • If a 3x function produces an error, the error message now includes the path to the file in which the function is defined.
    • Needs Assessment

    Description

      Puppet Version: main

      Desired Behavior:

      Legacy function errors should include the source path. For example, if you have a 3x function in module, like "$codedir/environments/production/modules/sample/lib/puppet/parser/functions/sample.rb" containing:

      module Puppet::Parser::Functions
        newfunction(:sample, :type => :rvalue, :doc => <<-EOS
          A function using the 3x API
        EOS
        ) do |arguments|
          "the returned value"
        end
       
        def method_here_is_illegal()
        end
      end
      

      Then puppet should return the filename where the legacy function is defined. See PUP-9294 and https://puppet.com/docs/puppet/5.5/functions_legacy.html for information about legacy (3x) function errors.

      For example, the following should indicate the path and line number of the legacy function:

      $ bundle exec puppet apply -e 'notice(sample(""))'
      

      Actual Behavior:

      No source path is included, e.g.

      ruby_legacy_function_instantiator.rb:97:in `walk': Illegal method definition of method 'initialize' on line 8 in legacy function. See https://puppet.com/docs/puppet/latest/functions_refactor_legacy.html for more information (SecurityError)
      

      Attachments

        Issue Links

          Activity

            People

              aria.li Aria Li
              lollipopman Jesse Hathaway
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support