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

The bundled version of puppet-lint fails when not called from the root of the repository

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDK 1.9.0
    • Component/s: None
    • Template:
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Fixes a bug in PDK where file targets were not evaluated based on the current working directory. This caused `pdk validate <target>` to fail when run from a module's subdirectory.
    • QA Risk Assessment:
      Needs Assessment

      Description

      When calling `pdk bundle exec puppet-lint $file` from the root of a repository, it works fine.

      [rnelson0@build03 domain_join:master]$ puppet-lint manifests/init.pp
      [rnelson0@build03 domain_join:master]$ pdk bundle exec puppet-lint manifests/init.pp
      pdk (INFO): Using Ruby 2.5.1
      pdk (INFO): Using Puppet 6.0.2
      

      When called from any other directory but still in the repo, it fails with "no file specified or specified file does not exist"

      [rnelson0@build03 domain_join:master]$ cd manifests/
      [rnelson0@build03 manifests:master]$ puppet-lint init.pp
      WARNING: indentation of => is not properly aligned (expected in column 15, but found it in column 14) on line 48
      WARNING: indentation of => is not properly aligned (expected in column 15, but found it in column 14) on line 52
      WARNING: indentation of => is not properly aligned (expected in column 17, but found it in column 16) on line 57
      WARNING: indentation of => is not properly aligned (expected in column 15, but found it in column 14) on line 65
      WARNING: indentation of => is not properly aligned (expected in column 13, but found it in column 12) on line 73
      WARNING: indentation of => is not properly aligned (expected in column 13, but found it in column 10) on line 75
      [rnelson0@build03 manifests:master]$ pdk bundle exec puppet-lint init.pp
      pdk (INFO): Using Ruby 2.5.1
      pdk (INFO): Using Puppet 6.0.2
      puppet-lint: no file specified or specified file does not exist
      puppet-lint: try 'puppet-lint --help' for more information[rnelson0@build03 manifests:master]$ cd ../spec
      [rnelson0@build03 spec:master]$ puppet-lint ../manifests/init.pp
      WARNING: indentation of => is not properly aligned (expected in column 15, but found it in column 14) on line 48
      WARNING: indentation of => is not properly aligned (expected in column 15, but found it in column 14) on line 52
      WARNING: indentation of => is not properly aligned (expected in column 17, but found it in column 16) on line 57
      WARNING: indentation of => is not properly aligned (expected in column 15, but found it in column 14) on line 65
      WARNING: indentation of => is not properly aligned (expected in column 13, but found it in column 12) on line 73
      WARNING: indentation of => is not properly aligned (expected in column 13, but found it in column 10) on line 75
      [rnelson0@build03 spec:master]$ pdk bundle exec puppet-lint ../manifests/init.pp
      pdk (INFO): Using Ruby 2.5.1
      pdk (INFO): Using Puppet 6.0.2
      puppet-lint: no file specified or specified file does not exist
      puppet-lint: try 'puppet-lint --help' for more information 

      What's weird is that the error message is ONLY from a PuppetLint::NoCodeError exception, which best I can tell is only triggered when `@code.nil?`. SeeĀ here and here. That appears to get set to nil in initialize/new, then pretty quickly get set in file=, then crash out in run ([here|https://github.com/rodjek/puppet-lint/blob/3c379cfe101d0e1705797c0191ab0194c66ef71b/lib/puppet-lint/bin.rb#L64-L66).] I'm not sure how the file= could fail since the path exists, unless the pdk is gobbling up the path somehow.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                tim.sharpe Tim Sharpe
                Reporter:
                rnelson0@gmail.com Rob Nelson
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: