-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: PDK 1.6.0
-
Fix Version/s: PDK 1.6.1
-
Component/s: None
-
Labels:
-
Environment:
Windows with PDK 1.6.0
-
Template:customfield_10700 262502
-
Team:Puppet Developer Experience
-
Method Found:Customer Feedback
-
Release Notes:Bug Fix
-
Release Notes Summary:Improved handling of unexpected errors when parsing the output of `puppet parser validate` as part of `pdk validate`.
-
QA Risk Assessment:Needs Assessment
When running PDK validate the command fails with the following error.
|
[\] Checking Puppet manifest syntax (**/**.pp).C:/PWKit/PuppetDevKit/private/ruby/2.4.4/lib/ruby/gems/2.4.0/gems/pdk-1.6.0/lib/pdk/validate/puppet/puppet_syntax.rb:89:in `parse_offense': undefined method `names' for nil:NilClass (NoMethodError)from C:/PWKit/PuppetDevKit/private/ruby/2.4.4/lib/ruby/gems/2.4.0/gems/pdk-1.6.0/lib/pdk/validate/puppet/puppet_syntax.rb:58:in `block in parse_output' |
It looks like this occurs when there are no matches to the regex in https://github.com/puppetlabs/pdk/blob/master/lib/pdk/validate/puppet/puppet_syntax.rb#L87
The issue comes in when puppet parser validate has an unrelated error. In this case, it was as follows.
$ puppet parser validate **\*.pp
|
C:/PWKit/Puppet/sys/ruby/lib/ruby/gems/2.4.0/gems/puppet-5.5.2-x64-mingw32/lib/puppet/environments.rb:38:in `get!': Could not find a directory environment named 'PUPPET_MASTER_SERVER=' anywhere in the path: C:/ProgramData/PuppetLabs/code/environments. Does the directory exist? (Puppet::Environments::EnvironmentNotFound) |
Can we add a check to ensure that attributes is populated, and if not, exit with the output from puppet parser validate?