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

Add JSON output option to `puppet parser validate`

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • PUP 6.5.0
    • None
    • Enhancement
    • Hide
      The `puppet parser validate` subcommand now supports a `--render-as=json` option to output validate errors in a machine readable JSON format.

      Additionally, when passed multiple target files, `puppet parser validate` will now continue validating additional files after a parse error instead of halting immediately on the first error encountered. (Note: It will still only return a maximum of one parse error per file.)
      Show
      The `puppet parser validate` subcommand now supports a `--render-as=json` option to output validate errors in a machine readable JSON format. Additionally, when passed multiple target files, `puppet parser validate` will now continue validating additional files after a parse error instead of halting immediately on the first error encountered. (Note: It will still only return a maximum of one parse error per file.)
    • Needs Assessment

    Description

      Running the following works, but still outputs plain text even though json is requested:

      ~ be puppet parser validate ~/Desktop/example2.pp --render-as json
      Error: Could not parse for environment production: Syntax error at 'ensure' at /Users/jpogran/Desktop/example2.pp:4:2
      

      This is important as some downstream tooling (i.e. our VSCode extension) would like to have structured input to parse. While the above example is one line, other errors span multiple, making parsing a brittle affair.

      A suggestion was to use puppet's loggin facility to log to a file and then parse that, but puppet parser validate does not recognize the --logdir paramter.

      Attachments

        Issue Links

          Activity

            People

              jesse Jesse Scott
              james.pogran James Pogran
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support