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

Add JSON output option to `puppet parser validate`

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 6.5.0
    • Component/s: None
    • Template:
    • Team:
      Puppet Developer Experience
    • Release Notes:
      Enhancement
    • Release Notes Summary:
      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.)
    • QA Risk Assessment:
      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

              jsd-sla-details-panel

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support