Uploaded image for project: 'Puppet Development Kit'
  1. Puppet Development Kit
  2. PDK-1183

Exclude module_root/pkg/**/* from `pdk validate` targets



    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PDK 1.8.0
    • 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


      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.


        Issue Links



              tim.sharpe Tim Sharpe
              tim.sharpe Tim Sharpe
              0 Vote for this issue
              1 Start watching this issue



                Zendesk Support