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

puppet parser validate fails for functions

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 4.4.0
    • Language
    • None
    • 1
    • Language 2016-02-24, Language 2016-03-09
    • Bug Fix
    • 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

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support