1PUPPET-PARSER(8) Puppet manual PUPPET-PARSER(8)
2
3
4
6 puppet-parser - Interact directly with the parser.
7
9 puppet parser action
10
12 Note that any setting that´s valid in the configuration file is also a
13 valid long argument, although it may or may not be relevant to the
14 present action. For example, server and run_mode are valid settings, so
15 you can specify --server <servername>, or --run_mode <runmode> as an
16 argument.
17
18 See the configuration file documentation at https://pup‐
19 pet.com/docs/puppet/latest/configuration.html for the full list of ac‐
20 ceptable parameters. A commented list of all configuration options can
21 also be generated by running puppet with --genconfig.
22
23 --render-as FORMAT
24 The format in which to render output. The most common formats
25 are json, s (string), yaml, and console, but other options such
26 as dot are sometimes available.
27
28 --verbose
29 Whether to log verbosely.
30
31 --debug
32 Whether to log debug information.
33
35 • dump - Outputs a dump of the internal parse tree for debugging:
36 SYNOPSIS
37
38 puppet parser dump [--e source] [--[no-]validate] [--format old,
39 pn, or json] [--pretty] [--format old|pn|json] [--pretty] { -e
40 source | [templates ...] }
41
42 DESCRIPTION
43
44 This action parses and validates the Puppet DSL syntax without com‐
45 piling a catalog or syncing any resources.
46
47 The output format can be controlled using the --format old|pn|json
48 where:
49
50 • ´old´ is the default, but now deprecated format which is not API.
51
52 • ´pn´ is the Puppet Extended S-Expression Notation.
53
54 • ´json´ outputs the same graph as ´pn´ but with JSON syntax.
55
56
57
58 The output will be "pretty printed" when the option --pretty is given
59 together with --format ´pn´ or ´json´. This option has no effect on the
60 ´old´ format.
61
62 The command accepts one or more manifests (.pp) files, or an -e fol‐
63 lowed by the puppet source text. If no arguments are given, the stdin
64 is read (unless it is attached to a terminal)
65
66 The output format of the dumped tree is intended for debugging purposes
67 and is not API, it may change from time to time.
68
69 OPTIONS --e <source> - dump one source expression given on the command
70 line.
71
72 --format <old, pn, or json> - Get result in ´old´ (deprecated format),
73 ´pn´ (new format), or ´json´ (new format in JSON).
74
75 --pretty - Pretty print output. Only applicable together with --format
76 pn or json
77
78 --[no-]validate - Whether or not to validate the parsed result, if
79 no-validate only syntax errors are reported
80
81 RETURNS
82
83 A dump of the resulting AST model unless there are syntax or validation
84 errors.
85
86 • validate - Validate the syntax of one or more Puppet manifests.:
87 SYNOPSIS
88
89 puppet parser validate [manifest] [manifest ...]
90
91 DESCRIPTION
92
93 This action validates Puppet DSL syntax without compiling a catalog
94 or syncing any resources. If no manifest files are provided, it
95 will validate the default site manifest.
96
97 When validating multiple issues per file are reported up to the
98 settings of max_error, and max_warnings. The processing stops after
99 having reported issues for the first encountered file with errors.
100
101 RETURNS
102
103 Nothing, or the first syntax error encountered.
104
105
106
108 validate
109
110 Validate the default site manifest at /etc/puppet/manifests/site.pp:
111
112 $ puppet parser validate
113
114 Validate two arbitrary manifest files:
115
116 $ puppet parser validate init.pp vhost.pp
117
118 Validate from STDIN:
119
120 $ cat init.pp | puppet parser validate
121
123 Copyright 2014 by Puppet Inc. Apache 2 license; see COPYING
124
125
126
127Puppet, Inc. October 2021 PUPPET-PARSER(8)