audit
audit copied to clipboard
Unable to compile the ruby gems
Cookbook version
6.0.1
Chef-client version
14.2.0
Platform Details
RHEL 7.5
Scenario:
Trying to have a compliance report based on "DevSec Linux Patch Benchmark"
Steps to Reproduce:
- Updated the runlist
- Excuted the chef-client
### Expected Result:
NameError
---------
inspec_gem[inspec] (audit::inspec line 20) had an error: NameError: undefined local variable or method `version' for #<#<Class:0x00000000041bce08>:0x0000000004086ea8>
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/audit/resources/inspec_gem.rb:31:in `block (2 levels) in class_from_file'
/var/chef/cache/cookbooks/audit/resources/inspec_gem.rb:30:in `block in class_from_file'
/var/chef/cache/cookbooks/audit/recipes/inspec.rb:24:in `from_file'
/var/chef/cache/cookbooks/audit/recipes/default.rb:30:in `from_file'
/var/chef/cache/cookbooks/ponit__audit/recipes/default.rb:6:in `from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/audit/resources/inspec_gem.rb:
24: converge_by 'uninstall all inspec and train gem versions' do
25: uninstall_inspec_gem
26: end
27: end
28:
29: if installation_required
30: converge_by 'install latest InSpec version' do
31>> install_inspec_gem(version: version, source: source)
32: end
33: else
34: Chef::Log.info("inspec_gem: not installing InSpec. It's already installed or an explicit version was not supplied.")
35: end
36: end
37:
38: action_class do
39: def install_inspec_gem(options)
40: gem_source = options[:source]
System Info:
------------
chef_version=14.2.0
platform=redhat
platform_version=7.5
ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
program_name=/bin/chef-client
executable=/opt/chef/bin/chef-client
Actual Result:
The report should be created without any issue
Were you able to resolve your issue? I ran into this today and I suspect is a cookbook vs. client version issue.
What happens if you use either [Chef-Client 12 and Cookbook 6] or [Chef-Client 14 and Cookbook version 7]?