Open
Description
Describe the Bug
Using ruby 3.4.1 throws NoMethodError. But works before with ruby 3.3.6
Expected Behavior
puppet-lint should parse and accept the site.pp file as before with ruby 3.3.6
Steps to Reproduce
- use ruby 3.4.1
- run pupet-lint on site.pp as shown below
Environment
- Ruby 3.4.1
- puppet-lint 4.2.4
Additional Context
Output of gitlab pipeline:
Using Docker executor with image ruby:3.4.1@sha256:db9366b572a746570a51e999b5f12d332c4e15ef0e2aee0d40a29e7dc27b3526 ...
Authenticating with credentials from /home/gitlab-runner/.docker/config.json
Pulling docker image ruby:3.4.1@sha256:db9366b572a746570a51e999b5f12d332c4e15ef0e2aee0d40a29e7dc27b3526 ...
Using docker image sha256:9605745cf429d893166c28f5f989f775f711828c0d5d2aa4c1e3839176dc89db for ruby:3.4.1@sha256:db9366b572a746570a51e999b5f12d332c4e15ef0e2aee0d40a29e7dc27b3526 with digest ruby@sha256:db9366b572a746570a51e999b5f12d332c4e15ef0e2aee0d40a29e7dc27b3526 ...
Preparing environment 00:03
Running on runner-m8ebwefe-project-159039-concurrent-0 via sbrinz09...
Getting source from Git repository 00:06
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/mlinux/mlinux/.git/
Created fresh repository.
Checking out 9e6634c2 as detached HEAD (ref is refs/merge-requests/3183/head)...
Skipping Git submodules setup
Executing "step_script" stage of the job script 00:07
Using docker image sha256:9605745cf429d893166c28f5f989f775f711828c0d5d2aa4c1e3839176dc89db for ruby:3.4.1@sha256:db9366b572a746570a51e999b5f12d332c4e15ef0e2aee0d40a29e7dc27b3526 with digest ruby@sha256:db9366b572a746570a51e999b5f12d332c4e15ef0e2aee0d40a29e7dc27b3526 ...
$ bundler install
Bundler 2.6.2 is running, but your lockfile was generated with 2.4.7. Installing Bundler 2.4.7 and restarting using that version.
Fetching gem metadata from https://rubygems.org/.
Fetching bundler 2.4.7
Installing bundler 2.4.7
Fetching gem metadata from https://rubygems.org/.
Using bundler 2.4.7
Fetching puppet-lint 4.2.4
Installing puppet-lint 4.2.4
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
$ puppet-lint --fail-on-warnings .
Whoops! It looks like puppet-lint has encountered an error that it doesn't
know how to handle. Please open an issue at https://github.com/puppetlabs/puppet-lint
and paste the following output into the issue description.
---
puppet-lint version: 4.2.4
ruby version: 3.4.1-p0
platform: x86_64-linux
file path: ./manifests/site.pp
file contents:
## site.pp ##
# This file (./manifests/site.pp) is the main entry point
# used when an agent connects to a master and asks for an updated configuration.
# https://puppet.com/docs/puppet/latest/dirs_manifest.html
#
# Global objects like filebuckets and resource defaults should go in this file,
# as should the default node definition if you want to use it.
## Active Configurations ##
# Disable filebucket by default for all File resources:
# https://github.com/puppetlabs/docs-archive/blob/master/pe/2015.3/release_notes.markdown#filebucket-resource-no-longer-created-by-default
File { backup => false }
## Node Definitions ##
# The default node definition matches any node lacking a more specific node
# definition. If there are no other node definitions in this file, classes
# and resources declared in the default node definition will be included in
# every node's catalog.
#
# Note that node definitions in this file are merged with node data from the
# Puppet Enterprise console and External Node Classifiers (ENC's).
#
# For more on node definitions, see: https://puppet.com/docs/puppet/latest/lang_node_definitions.html
#include profile::development
node default {
# This is where you can declare classes for all nodes.
# Example:
#class { 'simplib': }
#hiera_include('classes','notfound') Old instantiation of hiera include replaced from 6.0.0. to the one below according to: https://github.com/puppetlabs/puppet/blob/main/lib/puppet/parser/functions/hiera_include.rb
Exec {
path => ['/usr/local/bin', '/usr/local/sbin', '/usr/bin', '/usr/sbin', '/bin', '/sbin'],
}
include(lookup('classes', { 'default_value' => 'notfound', 'merge' => 'first' }))
}
error:
NoMethodError: undefined method '[]' for nil
/usr/local/bundle/gems/puppet-lint-4.2.4/lib/puppet-lint/data.rb:63:in 'PuppetLint::Data.tokens'
/usr/local/bundle/gems/puppet-lint-4.2.4/lib/puppet-lint/data.rb:608:in 'PuppetLint::Data.parse_control_comments'
/usr/local/bundle/gems/puppet-lint-4.2.4/lib/puppet-lint/checks.rb:26:in 'PuppetLint::Checks#load_data'
/usr/local/bundle/gems/puppet-lint-4.2.4/lib/puppet-lint/checks.rb:55:in 'PuppetLint::Checks#run'
/usr/local/bundle/gems/puppet-lint-4.2.4/lib/puppet-lint.rb:226:in 'PuppetLint#run'
/usr/local/bundle/gems/puppet-lint-4.2.4/lib/puppet-lint/bin.rb:85:in 'block in PuppetLint::Bin#run'
/usr/local/bundle/gems/puppet-lint-4.2.4/lib/puppet-lint/bin.rb:80:in 'Array#each'
/usr/local/bundle/gems/puppet-lint-4.2.4/lib/puppet-lint/bin.rb:80:in 'PuppetLint::Bin#run'
/usr/local/bundle/gems/puppet-lint-4.2.4/bin/puppet-lint:7:in '<top (required)>'
/usr/local/bundle/bin/puppet-lint:25:in 'Kernel#load'
/usr/local/bundle/bin/puppet-lint:25:in '<main>'