Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
None
-
Running `pdk validate` in a module that has previously used the puppet module tool to build a package.
-
Customer Feedback
-
Bug Fix
-
The `pkg` directory in the module root is now excluded from the default list of targets when running `pdk validate`.
-
Needs Assessment
Description
PMT stages the module being built in `pkg/<username><modulename><version>/` and doesn't clean it up after the package has been built. This can lead to a confusing "entity redefined" error when running the puppet syntax validator as two or more copies of the manifests are loaded.
geoff@computer:~/tmp/puppet-chown_r$ pdk validate puppet
|
pdk (INFO): Using Ruby 2.4.4
|
pdk (INFO): Using Puppet 5.5.6
|
[✖] Checking Puppet manifest syntax (**/**.pp).
|
Error: puppet-syntax: Attempt to redefine entity 'http://puppet.com/2016.1/runtime/type/chown_r'. Originally set at file:/home/geoff/tmp/puppet-chown_r/manifests/init.pp?line=18&pos=1.
|
Looking at the debug output shows the problem (in this case, 3 copies of each file being loaded):
pdk (DEBUG): Executing '/home/geoff/tmp/puppet-chown_r/bin/puppet parser validate --config /dev/null examples/init_manual.pp examples/init.pp manifests/init.pp pkg/geoffwilliams-chown_r-1.0.0/examples/init_manual.pp pkg/geoffwilliams-chown_r-1.0.0/examples/init.pp pkg/geoffwilliams-chown_r-1.0.0/manifests/init.pp pkg/geoffwilliams-chown_r-1.0.1/examples/init_manual.pp pkg/geoffwilliams-chown_r-1.0.1/examples/init.pp pkg/geoffwilliams-chown_r-1.0.1/manifests/init.pp'
|
Removing the `pkg` directory fixes the problem.
Although `pdk build` doesn't cause this problem as it cleans up after itself, we should still exclude `pkg/*/` from the validator targets as theres probably a lot of people that have these PMT artifacts in their working directory.
Attachments
Issue Links
- duplicates
-
PDK-925 pdk validate should skip spec/fixtures directory
-
- Closed
-
- is duplicated by
-
PDK-1203 pdk generates a 'Attempt to redefine entity' error when testing a module where the init.pp contains a define
-
- Closed
-
- relates to
-
PDK-1192 PDK scans non-puppet directories and chokes on files it should ignore
-
- Closed
-