inspec / kitchen-inspec

Test-Kitchen Plugin for InSpec
Other
109 stars 59 forks source link

uninitialised constant Kitchen::Verifier::Inspec::Hashie when declaring inputs #242

Open walterdolce opened 5 years ago

walterdolce commented 5 years ago

Version:

# Gemfile
source 'https://rubygems.org'

gem 'kitchen-ansible', '0.48.8'
gem 'kitchen-inspec', '1.2.0'
gem 'kitchen-vagrant', '1.3.4'
gem 'inspec-bin', '4.17.17'

Environment:

macOS

Scenario:

Trying to run bundle exec kitchen verify

Steps to Reproduce:

Create a .kitchen.yml and add the following bits to it:

verifier:
  name: inspec
  inputs:
    # make this an attribute required by one of the inspec tests below
    foo: bar
  inspec_tests:
  - path: ./path/to/some/inspec/tests

platforms:
  - name: ubuntu-16.04
    box: bento/ubuntu-16.04
    box_version: 201808.24.0

suites:
  - name: default

Expected Result:

test-kitchen fires the inspec verifier as normal (doesn't matter whether the tests pass or not)

Actual Result:

-----> Starting Kitchen (v1.25.0)
-----> Verifying <default-ubuntu-1604>...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #verify action: [uninitialized constant Kitchen::Verifier::Inspec::Hashie] on default-ubuntu-1604
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

[What actually happens after the reproduction steps?] ❓

Note: by commenting out the inputs section, the problem goes away. I can run inspec normally.

walterdolce commented 5 years ago

More to the above, which will hopefully help speeding up the resolution for this...

The problem is around here: https://github.com/inspec/kitchen-inspec/blob/master/lib/kitchen/verifier/inspec.rb#L121-L125

walterdolce commented 5 years ago

Hold on fire on this. It might be my machine which is misconfigured 😒 Closing for now while I investigate further. Will reopen if needed...

walterdolce commented 5 years ago

OK. I cleared my system of all the versions of Ruby I had installed with rbenv, leaving only one and the problem persists. Reopening.

walterdolce commented 5 years ago

Adding require "hashie" fixes the problem. I assume no unit/integration tests were in place for this scenario.

I'm going to PR this soon.

gekitsuu commented 5 years ago

I'm having this issue too

dlerch-transporeon commented 5 years ago

same issue here

walterdolce commented 5 years ago

PR is ready. Just need maintainers to review & accept. Use my branch in the meantime if that's blocking you.

gekitsuu commented 5 years ago

Bump