PDK commands accept arguments and options to customize behavior.

pdk build command

Builds a module package that can be published on the Forge.

Usage:

Within the module directory:
pdk build [--target-dir=<PATH>] [--force]
For example:
pdk build --target-dir=mymodules/my_module/pkg

To learn more, see building module packages. For step-by-step instructions, see the build a module topic.

ArgumentDescriptionValuesDefault
--target-dir=<PATH> The target directory where you want PDK to write the package.A directory path.Defaults to pkg directory in the module.
--force Skips the prompts and builds the module package. Overwrites any existing package, if one exists.None.By default, prompts are enabled.

pdk convert command

Converts an existing module to a standardized PDK module with an infrastructure for testing.

Usage:

Within the module directory:

pdk convert [--noop] [--force][--template-url=<GIT_URL>] [--skip-interview] [--full-interview]
For example:
pdk convert --template-url=https://github.com/puppetlabs/pdk-templates --skip-interview

To learn more, see converting modules. For step-by-step instructions, see the convert a module topic.

OptionDescriptionValueDefault
--noop Runs the command in a no operation or "no-op" mode. This shows what changes PDK will make without actually executing the changes. None.If not specified, the command makes the requested changes.
--force Runs the command, making changes without prompting for confirmation. This option manipulates files and is potentially destructive. Always back up your work before using this option.None.If not specified, the command prompts for confirmation.
--template-url=<GIT_URL> Specifies a template to use for this module.A valid Git URL or a path to a local template. A valid Git URL or a path to a local template.
--skip-interview Skip interview questions and use default values to create module metadata.None.If not specified, asks basic module metadata questions.
--full-interview Include interview questions related to publishing on the Forge to create module metadata. None.If not specified, asks only basic module metadata questions.

pdk new class command

Generates a new class and test templates for it in the current module.

Usage:

Within the module directory:
pdk new class [--template-url=<GIT_URL>] <class_name>
For example: pdk new class my_class

For step-by-step instructions, see the create a class topic.

ArgumentDescriptionValueDefault
--template-url=<GIT_URL> Specifies the template to use when generating this class.A valid Git URL or a path to a local template.Uses the same template that was used to generate the module. If that template is not available, defaults to pdk-template
<class_name> Required. The name of the class to generate.A class name beginning with a lowercase letter and including only lowercase letters, digits, and underscores.No default.

pdk new defined_type command

Generates a new defined type and test templates for it in the current module.

Usage:

Within the module directory:
pdk new defined_type [--template-url=<GIT_URL>] <defined_type_name>
For example: pdk new defined_type my_defined_type

For step-by-step instructions, see create a defined type topic.

ArgumentDescriptionValueDefault
--template-url=<GIT_URL> Specifies the template to use when generating this defined type.A valid Git URL or path to a local template.Uses the same template that was used to generate the module. If that template is not available, defaults to pdk-template .
<defined_type_name> Required. The name of the defined type to generate.A defined type name beginning with a lowercase letter and including only lowercase letters, digits, and underscores.No default.

pdk new module command

Creates a complete module skeleton and testing templates.

Usage:

pdk new module <module_name> [--template-url=<GIT_URL>] [--license=<IDENTIFIER>] [<TARGET_DIR>] [--skip-interview] [--full-interview] 

For example:

pdk new module my_module --template-url=https://github.com/puppetlabs/pdk-templates --full-interview mymodules/my_module

To learn more, see the creating modules topic. For step-by-step instructions, see the create a module topic.

ArgumentDescriptionValuesDefault
--template-url=<GIT_URL> Specifies a template to use for this module.A valid Git URL or path to a local template. If not specified, defaults to the pdk-template
--license=<IDENTIFIER> Specifies the license for this module is written under.See the SPDX License List for a list of open source licenses, or use proprietary. Apache-2.0
--skip-interview Skip interview questions and use default values to create module metadata.None.If not specified, PDK asks basic module metadata questions.
--full-interview Include interview questions related to publishing modules on the Forge to create module metadata.None.If not specified, PDK asks only basic module metadata questions. 
<module_name> Required. Specifies the name of the module being created. A module name beginning with a lowercase letter and including only lowercase letters, digits, and underscores.No default.
<TARGET_DIR> Specifies the directory that the new module will be created in.A valid directory path.Creates a directory with the given module_name inside the current directory.

pdk new task command

Generates a new task and task metadata in the current module.

Usage:

Within the module directory:
pdk new task [--template-url=<GIT_URL>] <task_name>      
For example: pdk new task my_task

For step-by-step instructions, see the create a task topic. 

ArgumentDescriptionValueDefault
--template-url=<GIT_URL> Specifies the template to use when generating this task.A valid Git URL or path to a local template. Uses the same template that was used to generate the module. If that template is not available, defaults to pdk-template
<task_name> Required. The name of the task to generate.A task name beginning with a lowercase letter and including only lowercase letters, digits, and underscores.No default.

pdk test unit command

Runs unit tests. Errors are displayed to the console and reported in the target file, if specified. The exit code is non-zero when errors occur.

Usage:

Within the module directory:
pdk test unit --list

pdk test unit [--tests=<TEST_LIST>] [--format=<FORMAT>[:<TARGET_FILE>]] [--pe-version=<VERSION>] [--puppet-version=<VERSION>]
For example:
pdk test unit --tests=test1,test2,test3 --puppet-version=5

pdk test unit --format=junit:report.xml --pe-version=2018.1 -c

To learn more, see the validating and testing modules topic. For step-by-step instructions, see the unit test a module topic.

ArgumentDescriptionValueDefault
--clean-fixtures, -c Cleans test fixtures, removing them from the directory and downloading them again the next time you run pdk test unit.None.If not specified, does not clean test fixtures.
--format=<FORMAT>[:<TARGET_FILE>] Specifies the format of the output. Optionally, you can specify a target file for the given output format, such as --format=junit:report.xml . You can specify multiple --format options if each has a distinct output target. To output to standard output or standard error, specify stdout or stderr as the target value.
  • junit (JUnit XML)

  • text (plain text)

If not specified, does not output to a file, but displays errors in the terminal.
--list Displays a list of unit tests and their descriptions. Using this option lists the tests without running them.No value. Optional --verbose or -v flag displays more information. No default.
--tests=<TEST_LIST> A comma-separated list of tests to run. Use this during development to pinpoint a single failing test.See the --list output for available values. No default.
--pe-version Specifies the  Puppet Enterprise (PE) version to run unit tests against. A string indicating the PE version to test against, such as "2017.3.5" or "2018.1".If not specified, tests against the most recent compatible Puppet version included in the PDK package.
--puppet-dev When specified, PDK runs unit tests against the current Puppet source from GitHub. To use this option, you must have network access to https://github.com. You cannot specify --puppet-dev together with the --puppet-version= or --pe-version= options.None.If not specified, PDK runs unit tests against default values or those specified by --puppet version or --pe-version.
--puppet-version Specifies the Puppet gem version to run unit tests against.A string indicating the Puppet version to test against, such as "5.4.2" or "5.5".If not specified, tests against the most recent compatible Puppet version included in the PDK package.

pdk update command

Update a PDK compatible module with any changes made to the module template.

Usage:

Within the module directory: 
pdk update [--force] [--noop]
For example: pdk update

To learn more, see updating the module with template changes. For step-by-step instructions, see the update a module topic.

ArgumentDescriptionValuesDefault
--force Update the module without prompts. Cannot be used together with --noop. None.If not specified, PDK prompts for user input.
--noop Shows what changes PDK would make, but does not actually make those changes. Cannot be used together with --force. None.If not specified, PDK prompts for user input and makes changes to the module on confirmation. 

pdk validate command

Runs all static validations. Any errors are reported to the console in the format requested. The exit code is non-zero when errors occur.

Usage:

Within the module directory: 
pdk validate --list

pdk validate [--format=<FORMAT>][:<TARGET_FILE>]] [<VALIDATIONS>] [<TARGETS>*] [--auto-correct] [--parallel] [--pe-version=<VERSION>] [--puppet-version=<VERSION>]
For example:
pdk validate --parallel --pe-version=2018.1

pdk validate --format=text:report.xml --auto-correct --parallel
To learn more, see the validating and testing modules topic. For step-by-step instructions, see the validate a module topic.
ArgumentDescriptionValuesDefault
--auto-correct, -a Automatically corrects some common code style problemsNone.Off.
--list Displays a list of available validations and their descriptions. Using this option lists the tests without running them.None.No default.
--format=<FORMAT>[:<TARGET_FILE>] Specifies the format of the output. Optionally, you can specify a target file for the given output format, such as --format=junit:report.xml . You can specify multiple --format options if each has a distinct output target. To output to standard output or standard error, specify stdout or stderr as the target value.
  • junit (JUnit XML)

  • text (plain text)

No default.
--parallel Runs all validations simultaneously, using multiple threads.None.If not specified, validations are run in succession on a single thread.
--pe-version Specifies the  Puppet Enterprise (PE) version to run validations against. A string indicating the PE version to validate against, such as "2017.3.5" or "2018.1". If not specified, validates against the most recent compatible Puppet version included in the PDK package.
--puppet-dev When specified, PDK validates against the current Puppet source from GitHub. To use this option, you must have network access to https://github.com. You cannot specify --puppet-dev together with the --puppet-version= or --pe-version= options.None.If not specified, PDK validates against default values or those specified by --puppet version or --pe-version.
--puppet-version Specifies the Puppet gem version to run validations against. A string indicating the Puppet version to validate against, such as "5.4.2" or "5.5". If not specified, validates against the most recent compatible Puppet version included in the PDK package.
<VALIDATIONS> A comma-separated list of validations to run or all for all validations. In PowerShell, this list must be enclosed in single quotes, such as pdk validate 'puppet,metadata' See the --list output for a list of available validations. all
<TARGETS> A list of directories or individual files to validate. Validations which are not applicable to individual files will be skipped for those files.A space-separated list of directories or files.Validates all available directories and files.
Back to top
The page rank or the 1 our of 5 rating a user has given the page.
The email address of the user submitting feedback.
The URL of the page being ranked/rated.