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
I have come across an error when trying to uploaded my compliance profile to chef-compliance. I got a server response of 500. Tailing the log it would seem that my profile is failing the inspec check command.
If I run it manually, it looks
inspec check .
C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.0/lib/train/transports/mock.rb:92:in digest: no implicit conversion of nil into String (TypeError)
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.0/lib/train/transports/mock.rb:92:in hexdigest
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.0/lib/train/transports/mock.rb:92:in run_command
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/resources/command.rb:26:in result
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/resources/command.rb:30:in stdout
from ./controls/01-config-checks.rb:6:in load
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/profile_context.rb:34:in instance_eval
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/profile_context.rb:34:in load
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/runner.rb:86:in add_content
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/runner.rb:60:in block in add_profile
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/runner.rb:57:in each
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/runner.rb:57:in add_profile
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/profile.rb:234:in load_params
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/profile.rb:49:in params
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/profile.rb:167:in rules_count
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/lib/inspec/profile.rb:136:in check
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/bin/inspec:53:in check
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in invoke_command
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in dispatch
from C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in start
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.3/bin/inspec:166:in <top (required)>
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/bin/inspec:23:in load
from C:/Users/xxxx/AppData/Local/chefdk/gem/ruby/2.1.0/bin/inspec:23:in <main>
It would seem that the check has a problem with line 6 in my example control
# encoding: utf-8
script = <<-EOH
$ENV:COMPUTERNAME
EOH
hostname = script(script).stdout.strip
# contents of robot.cfg
# ROBOTNAME = WIN-2012R2
control 'app-configuration-1.01' do
impact 1.0
title 'APP: Validating that ROBOTNAME matches the computer hostname'
desc 'Application wont work correctly if there is a mismatch between the ROBOTNAME and the computer name'
options = {
assignment_re: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/,
multiple_values: false
}
describe parse_config_file('C:\\TEMP\\robot.cfg', options) do
its('ROBOTNAME') {should eq hostname}
end
end
With a bit of testing it looks like it has an issue the '.stdout' part of the line
hostname = script(script).stdout.strip
My profiles do work, I have tested them both locally and using the winrm transport, and they work great :) the trouble is I have written quite a few using this technique and I can't use them :)
mock.rb:92 is the [Digest line
def run_command(cmd)
@commands[cmd] ||
@commands[Digest::SHA256.hexdigest cmd] ||
command_not_found(cmd)
end
The text was updated successfully, but these errors were encountered:
It's an oversight, and I guess not the last one considering that we are trying to read ruby during inspec check without any actual data (since there's no target backend yet ;) ). Happy to find and solve these!
Hi there
I have come across an error when trying to uploaded my compliance profile to chef-compliance. I got a server response of 500. Tailing the log it would seem that my profile is failing the inspec check command.
If I run it manually, it looks
It would seem that the check has a problem with line 6 in my example control
With a bit of testing it looks like it has an issue the '.stdout' part of the line
hostname = script(script).stdout.strip
My profiles do work, I have tested them both locally and using the winrm transport, and they work great :) the trouble is I have written quite a few using this technique and I can't use them :)
mock.rb:92 is the [Digest line
The text was updated successfully, but these errors were encountered: