Open rnelson0 opened 1 year ago
Complicating factors:
gem "voxpupuli-puppet-lint-plugins", '~> 4.0', require: false
So it could be related to those plugins, or the upgrade to pdk3.0.0, or both.
I can replicate this on a smaller file as well, definitely seems related to the single quote/empty following line
puppet-lint version: 3.4.0 ruby version: 3.2.2-p53 platform: x64-mingw32 file path: site/profile/manifests/windows/install_gmsa.pp file contents:
# Profile to add a Group Managed Service Account to a computer. This simply installs the MSA to the computer, you still have to specify
# it in a service.
class profile::windows::install_gmsa (
String $service_account,
) {
if (!defined(Windowsfeature['RSAT-AD-PowerShell'])) {
windowsfeature { 'RSAT-AD-PowerShell':
ensure => present,
}
}
exec { 'install-gmsa-account':
provider => powershell,
environment => ["gmsa_account=${service_account}"],
logoutput => false,
onlyif => '
If (Test-ADServiceAccount -Identity $Env:gmsa_account)
{
Exit 1
}
Exit 0
',
command => '
Try {
Install-ADServiceAccount -Identity $Env:gmsa_account -ErrorAction Stop
}
'
}
}
error:
TypeError: no implicit conversion from nil to integer
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-trailing_comma-check-1.0.0/lib/puppet-lint/plugins/check_trailing_comma.rb:145:in `insert'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-trailing_comma-check-1.0.0/lib/puppet-lint/plugins/check_trailing_comma.rb:145:in `fix'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checkplugin.rb:42:in `block in fix_problems'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checkplugin.rb:38:in `each'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checkplugin.rb:38:in `fix_problems'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checks.rb:67:in `block in run'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checks.rb:65:in `each'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checks.rb:65:in `run'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint.rb:224:in `run'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/bin.rb:84:in `block in run'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/bin.rb:80:in `each'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/bin.rb:80:in `run'
C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/bin/puppet-lint:7:in `<top (required)>'
C:/Users/username/git/controlrepo/bin/puppet-lint:27:in `load'
C:/Users/username/git/controlrepo/bin/puppet-lint:27:in `<main>'
Running
pdk validate -a
against a controlrepo generates the following error. When this occurs, it stops and does not validate other files. Remove the blank line at the end resolves the error with this file, and it is validated properly. However, an issue is encountered on the next file that has that blank line issue as well, stopping again.Thus I see two problems here:
When encountering a file that has a single quote followed by a blank line followed by a curly brace, it cannot validate that file. Removing the blank line prevents the issue. The conditions for this may be more complicated but can be replicated with this pattern at the end of the file, where at least the indentation does not seem to matter:
puppet-lint version: 3.4.0 ruby version: 3.2.2-p53 platform: x64-mingw32 file path: site/profile/manifests/faxing/faxpocfs.pp file contents:
TypeError: no implicit conversion from nil to integer C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-trailing_comma-check-1.0.0/lib/puppet-lint/plugins/check_trailing_comma.rb:145:in'
insert' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-trailing_comma-check-1.0.0/lib/puppet-lint/plugins/check_trailing_comma.rb:145:in
fix' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checkplugin.rb:42:inblock in fix_problems' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checkplugin.rb:38:in
each' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checkplugin.rb:38:infix_problems' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checks.rb:67:in
block in run' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checks.rb:65:ineach' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/checks.rb:65:in
run' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint.rb:224:inrun' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/bin.rb:84:in
block in run' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/bin.rb:80:ineach' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/lib/puppet-lint/bin.rb:80:in
run' C:/Users/username/AppData/Local/PDK/cache/ruby/3.2.0/gems/puppet-lint-3.4.0/bin/puppet-lint:7:in<top (required)>' C:/Users/username/git/controlrepo/bin/puppet-lint:27:in
load' C:/Users/username/git/controlrepo/bin/puppet-lint:27:in `