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

Top-scope Puppet function behavior is inconsistent with documentation

    Details

    • Template:
    • Team:
      Puppet Developer Experience
    • Story Points:
      2
    • Sprint:
      PDE 2017-05-03, PDE 2017-05-31
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      It was not possible to call a function defined in the main manifest from logic in a module. This now works for those special occasions when it is actually needed, but the best practice is to autoload functions.
    • QA Risk Assessment:
      Manual

      Description

      Per https://docs.puppet.com/puppet/4.10/lang_write_functions_in_puppet.html it is possible to write Puppet-language functions in the main manifest (top-scope). The warning in the documentation indicates that the behavior, as with other top-scope items, would be to have the function accessible to all modules.

      However, if you define a function in the main manifest and then try to call it from a module you will receive an error such as: "Error: Evaluation Error: Unknown function: 'testfunc'". It works fine when called from the main manifest. Calling it with the leading "::" indicating top-scope has no change in behavior.

      The expected behavior is that top-scope Puppet language functions would work per the documentation and similarly to their Ruby counterparts.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                seanmil Sean Millichamp
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: