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

puppet parser validate fails for functions

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 4.4.0
    • Component/s: Language
    • Labels:
      None
    • Template:
    • Epic Link:
    • Story Points:
      1
    • Sprint:
      Language 2016-02-24, Language 2016-03-09
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      puppet parser validate failed when validating manifests containing functions written in the puppet language when they were in regular manifests. The functions in autoloaded locations are not validated by "puppet parser validate".

      Description

      The following is valid puppet code in puppet 4, and will run using a puppet apply, but fails a puppet parser validate:

      function validate_this() {
        notice('hello, puppet')
      }
       
      validate_this()
      

      Using puppet apply, I get:

      $ puppet apply testcase.pp
      Notice: Scope(Class[main]): hello, puppet
      Notice: Compiled catalog for macbook.whilefork.com in environment production in 0.03 seconds
      Notice: Applied catalog in 0.02 seconds
      

      When I attempt to validate it:

      puppet parser validate testcase.pp
      Error: Internal Error: Puppet Context ':loaders' missing - cannot define any functions
      

      We use puppet parser validate in our CI to validate that all .pp files are valid puppet code, so this makes it more difficult to validate puppet code now that we're starting to use functions defined in the puppet language.

      I've validated that this occurs on puppet 4.3.2 on OS X and puppet 4.2.3 on CentOS 7.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  daniel.dreier Daniel Dreier
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support