Jira (PUP-11472) Legacy function error does not include the source ref

24 views
Skip to first unread message

Jesse Hathaway (Jira)

unread,
Feb 28, 2022, 6:18:03 PM2/28/22
to puppe...@googlegroups.com
Jesse Hathaway created an issue
 
Puppet / Bug PUP-11472
Legacy function error does not include the source ref
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2022/02/28 3:17 PM
Priority: Normal Normal
Reporter: Jesse Hathaway

Puppet Version: main

Desired Behavior:

Legacy function errors would include the source path

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)

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Jesse Hathaway (Jira)

unread,
Feb 28, 2022, 6:20:03 PM2/28/22
to puppe...@googlegroups.com

Nirupama Mantha (Jira)

unread,
Mar 1, 2022, 4:10:03 PM3/1/22
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Apr 6, 2022, 9:22:03 PM4/6/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Phoenix 2022-04-27

Lisa Ross (Jira)

unread,
Apr 7, 2022, 11:17:01 AM4/7/22
to puppe...@googlegroups.com

Lisa Ross (Jira)

unread,
Apr 7, 2022, 11:19:02 AM4/7/22
to puppe...@googlegroups.com
Lisa Ross updated an issue
Change By: Lisa Ross
Fix Version/s: PUP 7.17.0
Fix Version/s: PUP 6.28.0

Nirupama Mantha (Jira)

unread,
Apr 13, 2022, 11:45:03 AM4/13/22
to puppe...@googlegroups.com
Nirupama Mantha updated an issue
Change By: Nirupama Mantha
Sprint: Phoenix 2022- 04 05 - 27 11

Josh Cooper (Jira)

unread,
Apr 27, 2022, 12:31:04 PM4/27/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
*Puppet Version:* main

*Desired Behavior:*

Legacy function errors
would 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:

{code:ruby}
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
{code}

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:

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

*Actual Behavior:*


No source path is included, e.g.


{noformat}

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)

{noformat}

Josh Cooper (Jira)

unread,
Apr 27, 2022, 12:33:01 PM4/27/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
*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:


{code:ruby}
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
{code}

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 :


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

*Actual Behavior:*

No source path is included, e.g.

{noformat}
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)

{noformat}

Josh Cooper (Jira)

unread,
Apr 27, 2022, 12:33:02 PM4/27/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Community Contributors: lollipopman

Aria Li (Jira)

unread,
Apr 27, 2022, 6:22:01 PM4/27/22
to puppe...@googlegroups.com
Aria Li assigned an issue to Aria Li
Change By: Aria Li
Assignee: Aria Li

Josh Cooper (Jira)

unread,
May 10, 2022, 12:17:01 PM5/10/22
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
May 10, 2022, 12:19:01 PM5/10/22
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Release Notes: Enhancement
Release Notes Summary: If a 3x function produces an error, the error message now includes the path to the file in which the function is defined.

Parker Leach (Jira)

unread,
May 23, 2022, 12:40:02 PM5/23/22
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages