You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With amazonlinux:2.0.20181010 image, the contents of /etc/system-release file are as follows:
Amazon Linux release 2 (Karoo)
When running this simple script
def redhatish_version(conf)
case conf
when /rawhide/i
/((\d+) \(Rawhide\))/i.match(conf)[1].downcase
when /Amazon Linux AMI/i
/release ([\d\.]+)/.match(conf)[1]
when /derived from .*linux|amazon/i
/Linux ((\d+|\.)+)/i.match(conf)[1]
else
/release ([\d\.]+)/.match(conf)[1]
end
end
redhatish_version("Amazon Linux release 2 (Karoo)")
It generates the following error message, which is consistent with kitchen verify error
undefined method `[]' for nil:NilClass
(repl):8:in `redhatish_version'
(repl):14:in `<main>'
Possible Solutions
Here is modified redhatish_version. I also suggest catching an exception to provide some context to the end user
def redhatish_version(conf)
begin
case conf
when /rawhide/i
/((\d+) \(Rawhide\))/i.match(conf)[1].downcase
when /Amazon Linux AMI/i
/release ([\d\.]+)/.match(conf)[1]
when /amazon/i
matched = /Linux ((\d+|\.)+)/i.match(conf)
unless matched.nil?
return matched[1]
end
/release ([\d\.]+)/.match(conf)[1]
when /derived from .*linux/i
/Linux ((\d+|\.)+)/i.match(conf)[1]
else
/release ([\d\.]+)/.match(conf)[1]
end
rescue => e
raise RuntimeError, "Cannot parse redhatish OS version", e.backtrace
end
end
Stacktrace
E, [2018-11-27T13:29:23.442161 #76442] ERROR -- Kitchen: ------Backtrace-------
E, [2018-11-27T13:29:23.442176 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/helpers/os_linux.rb:16:in `redhatish_version'
E, [2018-11-27T13:29:23.442193 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/specifications/os.rb:194:in `block in load'
E, [2018-11-27T13:29:23.442219 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:46:in `instance_eval'
E, [2018-11-27T13:29:23.442237 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:46:in `block in scan_children'
E, [2018-11-27T13:29:23.442254 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `each'
E, [2018-11-27T13:29:23.442270 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `scan_children'
E, [2018-11-27T13:29:23.442285 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:60:in `scan_family_children'
E, [2018-11-27T13:29:23.442310 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:51:in `block in scan_children'
E, [2018-11-27T13:29:23.442325 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `each'
E, [2018-11-27T13:29:23.442339 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `scan_children'
E, [2018-11-27T13:29:23.442354 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:60:in `scan_family_children'
E, [2018-11-27T13:29:23.442369 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:51:in `block in scan_children'
E, [2018-11-27T13:29:23.442383 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `each'
E, [2018-11-27T13:29:23.442398 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `scan_children'
E, [2018-11-27T13:29:23.442412 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:60:in `scan_family_children'
E, [2018-11-27T13:29:23.442427 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:51:in `block in scan_children'
E, [2018-11-27T13:29:23.442442 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `each'
E, [2018-11-27T13:29:23.442457 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:45:in `scan_children'
E, [2018-11-27T13:29:23.442471 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:33:in `block in scan'
E, [2018-11-27T13:29:23.442486 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:27:in `each'
E, [2018-11-27T13:29:23.442501 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect/scanner.rb:27:in `scan'
E, [2018-11-27T13:29:23.442515 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/platforms/detect.rb:9:in `scan'
E, [2018-11-27T13:29:23.442530 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/plugins/base_connection.rb:114:in `platform'
E, [2018-11-27T13:29:23.442544 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/extras/command_wrapper.rb:128:in `load'
E, [2018-11-27T13:29:23.443154 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/transports/ssh_connection.rb:53:in `initialize'
E, [2018-11-27T13:29:23.443174 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/transports/ssh.rb:208:in `new'
E, [2018-11-27T13:29:23.443196 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/transports/ssh.rb:208:in `create_new_connection'
E, [2018-11-27T13:29:23.443214 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/train-1.5.6/lib/train/transports/ssh.rb:81:in `connection'
E, [2018-11-27T13:29:23.443229 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/inspec-3.0.52/lib/inspec/backend.rb:51:in `create'
E, [2018-11-27T13:29:23.443243 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/inspec-3.0.52/lib/inspec/runner.rb:66:in `configure_transport'
E, [2018-11-27T13:29:23.443258 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/inspec-3.0.52/lib/inspec/runner.rb:58:in `initialize'
E, [2018-11-27T13:29:23.443272 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/kitchen-inspec-0.25.0/lib/kitchen/verifier/inspec.rb:81:in `new'
E, [2018-11-27T13:29:23.443287 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/kitchen-inspec-0.25.0/lib/kitchen/verifier/inspec.rb:81:in `call'
E, [2018-11-27T13:29:23.443301 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:458:in `block in verify_action'
E, [2018-11-27T13:29:23.443316 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:551:in `synchronize_or_call'
E, [2018-11-27T13:29:23.443331 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:513:in `block in action'
E, [2018-11-27T13:29:23.443346 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/2.5.0/benchmark.rb:293:in `measure'
E, [2018-11-27T13:29:23.443361 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:512:in `action'
E, [2018-11-27T13:29:23.443376 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:450:in `verify_action'
E, [2018-11-27T13:29:23.443391 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:382:in `block (2 levels) in transition_to'
E, [2018-11-27T13:29:23.443405 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/lifecycle_hooks.rb:45:in `run_with_hooks'
E, [2018-11-27T13:29:23.443420 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:381:in `block in transition_to'
E, [2018-11-27T13:29:23.443435 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:380:in `each'
E, [2018-11-27T13:29:23.443449 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:380:in `transition_to'
E, [2018-11-27T13:29:23.443464 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/instance.rb:162:in `verify'
E, [2018-11-27T13:29:23.443478 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/command.rb:197:in `public_send'
E, [2018-11-27T13:29:23.443493 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/command.rb:197:in `run_action_in_thread'
E, [2018-11-27T13:29:23.443507 #76442] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.23.2/lib/kitchen/command.rb:169:in `block (2 levels) in run_action'
E, [2018-11-27T13:29:23.443522 #76442] ERROR -- Kitchen: ----End Backtrace-----
The text was updated successfully, but these errors were encountered:
Description
When trying to run
kitchen verify
usingdocker
driver and amazonlinux v2 image getting this errorTrain and Platform Version
Train version 1.5.6
Chef Development Kit Version: 3.5.13
chef-client version: 14.7.17
delivery version: master (6862f27aba89109a9630f0b6c6798efec56b4efe)
berks version: 7.0.6
kitchen version: 1.23.2
inspec version: 3.0.52
MacOS Sierra version 10.12.6
Docker Desktop Community version 2.0.0.0-mac78 (28905)
Replication Case
Here are the contents of
.kitchen.yml
With amazonlinux:2.0.20181010 image, the contents of
/etc/system-release
file are as follows:When running this simple script
It generates the following error message, which is consistent with
kitchen verify
errorPossible Solutions
Here is modified
redhatish_version
. I also suggest catching an exception to provide some context to the end userStacktrace
The text was updated successfully, but these errors were encountered: