puppet-parser man page

puppet-parser — Interact directly with the parser.

Synopsis

puppet parser action

Options

Note that any setting that´s valid in the configuration file is also a valid long argument, although it may or may not be relevant to the present action. For example, server and run_mode are valid settings, so you can specify --server <servername>, or --run_mode <runmode> as an argument.

See the configuration file documentation at https://docs.puppetlabs.com/puppet/latest/reference/configuration.html for the full list of acceptable parameters. A commented list of all configuration options can also be generated by running puppet with --genconfig.

--render-as FORMAT

The format in which to render output. The most common formats are json, s (string), yaml, and console, but other options such as dot are sometimes available.

--verbose

Whether to log verbosely.

--debug

Whether to log debug information.

Actions

The output will be "pretty printed" when the option --pretty is given together with --format ´pn´ or ´json´. This option has no effect on the ´old´ format.

The command accepts one or more manifests (.pp) files, or an -e followed by the puppet source text. If no arguments are given, the stdin is read (unless it is attached to a terminal)

The output format of the dumped tree is intended for debugging purposes and is not API, it may change from time to time.

Options --e <source> - dump one source expression given on the command line.

--format <old, pn, or json> - Get result in ´old´ (deprecated format), ´pn´ (new format), or ´json´ (new format in JSON).

--pretty - Pretty print output. Only applicable together with --format pn or json

--[no-]validate - Whether or not to validate the parsed result, if no-validate only syntax errors are reported

RETURNS

A dump of the resulting AST model unless there are syntax or validation errors.

Examples

validate

Validate the default site manifest at /etc/puppetlabs/puppet/manifests/site.pp:

$ puppet parser validate

Validate two arbitrary manifest files:

$ puppet parser validate init.pp vhost.pp

Validate from STDIN:

$ cat init.pp | puppet parser validate

Info

April 2018 Puppet, Inc. Puppet manual