Starting receiving an error with pdk 3.4.0 and a n...
# testing
r
Starting receiving an error with pdk 3.4.0 and a new json gem build, has anyone else hit this?
๐Ÿงต 1
Copy code
15:00:35  + make pdk_unit
15:00:35  Executing pdk unit tests
15:00:36  pdk (INFO): Using Ruby 2.7.8
15:00:36  pdk (INFO): Using Puppet 7.34.0
15:02:31  /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/util/json_finder.rb:78:in `+': no implicit conversion of nil into String (TypeError)
15:02:31  
15:02:31              matched_text += read_object
15:02:31                              ^^^^^^^^^^^
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/util/json_finder.rb:78:in `read_object'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/util/json_finder.rb:78:in `read_object'
The stack trace mentions the same file:line about 20 times before going deeper in the stack but doesn't tell me what file it's reading
This started happening on 12/3 when json 2.17.0 was released. A new 2.17.1 fixed a regression but the same problem occurs. Pining to 2.16.0 works fine.
b
yeah 2.17 is a bit stricter
but your output looks odd
"Using Ruby 2.7.8" but also "/opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/"
r
yeah maybe we have something malformed but no idea what file it's reading
b
that doesn't match. But I don't know if this is normal for pdk
are you testing on puppet 7 on purpose?
r
yes, we're using puppet 7
b
๐Ÿ˜ž
sadluke
r
lol another group announced they're killing puppet 4. next year. don't complain ๐Ÿ˜„
b
don't justify your EoL setup with the EoL setup from others ๐Ÿ˜›
all the testing gems dropped Ruby 2.7 support, which makes upgrades now a bit more challenging
r
ya and christmas isn't far away before they drop the next version
but right now trying to figure out how to find whatever file it's choking on
b
all the puppet testing tools will keep ruby 3.1/3.2 support until puppet 8 is dead
r
the bottom of the trace doesn't get more helpful
Copy code
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/util/json_finder.rb:36:in `objects'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/util.rb:203:in `find_all_json_in'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/tests/unit.rb:126:in `invoke'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/cli/test/unit.rb:79:in `block (2 levels) in <module:CLI>'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/cri-2.15.12/lib/cri/command.rb:362:in `run_this'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/cri-2.15.12/lib/cri/command.rb:298:in `run'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/cri-2.15.12/lib/cri/command.rb:316:in `run'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/cri-2.15.12/lib/cri/command.rb:316:in `run'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/cli.rb:58:in `run'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/exe/pdk:6:in `<top (required)>'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/bin/pdk:25:in `load'
15:02:31  	from /opt/puppetlabs/pdk/private/ruby/3.2.5/bin/pdk:25:in `<main>'
15:02:31  make: *** [Makefile:22: pdk_unit] Error 1
other than metadata.json what else would pdk be using the json gem for?
b
parsing factsets from facterdb
๐Ÿค” 1
r
gem "facterdb", '~> 2.1',                      require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
b
god that is so old
r
well ruby < 3 so yeah
june 2024, actually not nearly as old as I expected
i do wonder if that limit is reasonable, 3.10.0 still supports ruby 2.7
b
the thing is, it looks like your pdk is using Ruby 3.2
r
i dunno, i think the pdk command itself calls that and then starts another process? i dunno
b
yeah maybe
r
i don't understand any of this sometimes and this is one of those days lol
b
but now you can say 'testing with pdk isnt possible anymore, we have to upgrade'
r
yesterday i was troubleshooting an ssh session that just dies, found out it's not using an ssh client but is instantiated with javascript ๐Ÿ˜ฑ
b
haha
r
ya, i think we've tried doing it with raw ruby but it doesn't scale well for us.
this at least if we pin it to json 2.16.0 it works ๐Ÿคท
i asked them to try without the strict facterdb version pining and see what happens. something to try at least.
thanks for the suggestion! anything else involving json that you can think of?
b
mhm
not right now, no
๐Ÿ‘ 1
out of interest; are there plans to go to Puppet 8? I think you're on PE?
r
no PE, not sure after the latest kerfluffle