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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDK 1.8.0
    • Component/s: None
    • Environment:

      Running `pdk validate` in a module that has previously used the puppet module tool to build a package.

    • Template:
    • Method Found:
      Customer Feedback
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      The `pkg` directory in the module root is now excluded from the default list of targets when running `pdk validate`.
    • QA Risk Assessment:
      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

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  tim.sharpe Tim Sharpe
                  Reporter:
                  tim.sharpe Tim Sharpe
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: