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

Puppet should give a more direct error when it can't find a 4.x function because of a missing module dependency

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Duplicate
    • Affects Version/s: PUP 4.8.1
    • Fix Version/s: None
    • Component/s: None
    • Template:
    • Team:
      Platform Core
    • QA Risk Assessment:
      Needs Assessment

      Description

      The Problem

      See PUP-6952 for some background. If you want to use a 4.x style function declared in another module you have to make that module a dependency of your module.

      If you don't declare the dependency then you get an error like this:

      Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Unknown function: 'type_of'. at /etc/puppetlabs/code/environments/production/modules/puppetdb_gc/manifests/gc_cron.pp:12:29  at /etc/puppetlabs/code/environments/production/modules/puppetdb_gc/manifests/init.pp:30 on node agent-181-centos.puppetdebug.vlan
      

      Suggested Solution

      The error message should be more clear about why it couldn't find the function.

      The compiler should check the declared dependency modules for a function and if it does not find it then expand the search to all modules in the modulepath so the error message can be more direct about what might need to happen.

      The same error message could have something like the following added to it to make it more clear

      "There is a type_of function in the stdlib module which is not declared as a dependency of this module. Please add stdlib as a dependency of this module if you intended to use type_of from stdlib."

      Exact wording not recommended but you get the idea.

      Side note

      If you don't declare any dependencies for your module then you don't run into this as then the default behavior is to look through all modules.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              nick.walker Nick Walker
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support