-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using profiles with kitchen-inspec #66
Comments
@benjamink Thanks for reporting. The reason for that is, that profile inheritance is not supported in |
Now that #75 is merged, is this issue resolved @benjamink ? |
System infoTest Kitchen version 1.11.1 IssueCannot get it to work: 07:45:19 $ kitchen verify twemproxy-debian7-lxc
-----> Starting Kitchen (v1.11.1)
-----> Verifying <twemproxy-debian7-lxc>...
Use `/<redacted>/test/integration/twemproxy` for testing
Use `/<redacted>/test/integration/twemproxy` for testing
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Failed to complete #verify action: [undefined method `list' for {}:Hash] on twemproxy-debian7-lxc
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration Debug outputDebug output, added two lines to see exackly values od 07:51:32 $ kitchen verify twemproxy-debian7-lxc -l debug
-----> Starting Kitchen (v1.11.1)
D [Vagrant command] BEGIN (vagrant --version)
D [Vagrant command] END (0m0.19s)
-----> Verifying <twemproxy-debian7-lxc>...
D Initialize InSpec
Use `/<redacted>/test/integration/twemproxy` for testing
D local_suite_files: '["/<redacted>/test/integration/twemproxy"]'
D config[:inspec_tests]: '[]'
Use `/<redacted>/test/integration/twemproxy` for testing
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>> Failed to complete #verify action: [undefined method `list' for {}:Hash] on twemproxy-debian7-lxc
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
D ------Exception-------
D Class: Kitchen::ActionFailed
D Message: 1 actions failed.
>>>>>> Failed to complete #verify action: [undefined method `list' for {}:Hash] on twemproxy-debian7-lxc
D ----------------------
D ------Backtrace-------
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:187:in `report_errors'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:178:in `run_action'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command/action.rb:39:in `block in call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command/action.rb:37:in `call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/cli.rb:56:in `perform'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/cli.rb:185:in `block (2 levels) in <class:CLI>'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/thor-0.19.0/lib/thor/command.rb:27:in `run'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/thor-0.19.0/lib/thor/invocation.rb:126:in `invoke_command'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/cli.rb:326:in `invoke_task'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/thor-0.19.0/lib/thor.rb:359:in `dispatch'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/thor-0.19.0/lib/thor/base.rb:440:in `start'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/bin/kitchen:13:in `block in <top (required)>'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/errors.rb:174:in `with_friendly_errors'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/bin/kitchen:13:in `<top (required)>'
D /home/kaszpir/.rbenv/versions/2.1.3/bin/kitchen:23:in `load'
D /home/kaszpir/.rbenv/versions/2.1.3/bin/kitchen:23:in `<main>'
D ----End Backtrace-----
D -Composite Exception--
D Class: Kitchen::ActionFailed
D Message: Failed to complete #verify action: [undefined method `list' for {}:Hash] on twemproxy-debian7-lxc
D ----------------------
D ------Backtrace-------
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/dsl.rb:37:in `load_spec_files_for_profile'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/dsl.rb:15:in `include_controls'
D /<redacted>/test/integration/twemproxy/controls/profile.rb:1:in `load'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/profile_context.rb:82:in `instance_eval'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/profile_context.rb:82:in `load'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:174:in `add_test_to_context'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:135:in `block in add_content'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:135:in `each'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:135:in `add_content'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:110:in `add_profile'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:73:in `add_target'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.15.0/lib/kitchen/verifier/inspec.rb:72:in `block in call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.15.0/lib/kitchen/verifier/inspec.rb:72:in `each'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.15.0/lib/kitchen/verifier/inspec.rb:72:in `call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:423:in `block in verify_action'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:513:in `call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:513:in `synchronize_or_call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:478:in `block in action'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:477:in `action'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:415:in `verify_action'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:348:in `block in transition_to'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:347:in `each'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:347:in `transition_to'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:160:in `verify'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:201:in `public_send'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:201:in `run_action_in_thread'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:173:in `block (2 levels) in run_action'
D ----End Backtrace-----
D ---Nested Exception---
D Class: Kitchen::ActionFailed
D Message: Failed to complete #verify action: [undefined method `list' for {}:Hash]
D ----------------------
D ------Backtrace-------
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/dsl.rb:37:in `load_spec_files_for_profile'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/dsl.rb:15:in `include_controls'
D /<redacted>/test/integration/twemproxy/controls/profile.rb:1:in `load'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/profile_context.rb:82:in `instance_eval'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/profile_context.rb:82:in `load'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:174:in `add_test_to_context'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:135:in `block in add_content'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:135:in `each'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:135:in `add_content'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:110:in `add_profile'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/inspec-0.32.0/lib/inspec/runner.rb:73:in `add_target'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.15.0/lib/kitchen/verifier/inspec.rb:72:in `block in call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.15.0/lib/kitchen/verifier/inspec.rb:72:in `each'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.15.0/lib/kitchen/verifier/inspec.rb:72:in `call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:423:in `block in verify_action'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:513:in `call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:513:in `synchronize_or_call'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:478:in `block in action'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:477:in `action'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:415:in `verify_action'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:348:in `block in transition_to'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:347:in `each'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:347:in `transition_to'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/instance.rb:160:in `verify'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:201:in `public_send'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:201:in `run_action_in_thread'
D /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/test-kitchen-1.11.1/lib/kitchen/command.rb:173:in `block (2 levels) in run_action'
D ----End Backtrace-----
Running test directly in inspecRunning inspec works, becuase we point it into the profile directly, although looks like it really does not care about 07:50:56 $ inspec exec test/integration/twemproxy -t ssh://[email protected] --password root
✔ package-bzip2: System Package bzip2 should be installed
System Package bzip2 should be installed
✔ package-screen: System Package screen should be installed
System Package screen should be installed
✔ package-mc: System Package mc should be installed
System Package mc should be installed
✔ package-htop: System Package htop should be installed
System Package htop should be installed
✔ package-ntp: System Package screen should be installed
System Package screen should be installed
✔ service-ntp-enabled: Service ntp should be enabled
Service ntp should be enabled
✔ service-ntp-running: Service ntp should be running
Service ntp should be running
Profile: InSpec Profile for twemproxy/nutrcacker (twemproxy)
Version: 1.0.0
Target: ssh://[email protected]:22
No tests executed.
Summary: 7 successful, 0 failures, 0 skipped Directory structure
Contents of other filesContents of the
|
@nvtkaszpir I looks like this is the same error as #101 |
I was wondering if to merge them, but so far I decided to split it. #101 should handle showing more user friendly message about missing suites/profiles - it's more like kitchen suites do not match inspec suites. #66 deals with profiles in general, where kitchen-inspec is unable to find dependencies within inspec profiles. You can get workaround #66 with not using profiles, but if you got bad suites/platforms then you will hit #101 |
We are just finalizing the dependency management in InSpec, once its ready, it will be available in kitchen-inspec as well. This should cover this issue. |
OK, I understand it, right now kitchen-inspect + inspect profiles are not compatible. For now the only workaround is to use multiple tests within suite, and avoiding inspec profiles in tests within suite. |
@nvtkaszpir You can use InSpec profiles, only the dependency feature is not available yet |
Ah, that explains it :) |
It should work, once you remove the |
Not really, the |
Which version of inspec and kitchen-inspec are you using? |
Test Kitchen version 1.11.1 |
is the problem also happening if you use the example profile from inspec? https://github.com/chef/inspec/tree/master/examples/profile |
using kitchen.yml seciton: inspec_tests:
- test/integration/profile but if I take another profile (lets name it include_controls 'profile'do
end and will change in kitchen.yml inspec_tests:
- test/integration/steve then it dies with error message here is a package you may want to test: |
|
I let you know, once this feature is available in |
ok, so far I can work without dependency. |
btw, but it worked before inspec 0.32.0, I know cause I had working kitchen.yml files for aws ;) |
okay, good to know. Can you provide the simplest example that breaks it. I'd like to add this to our inspec integration tests |
#66 (comment) see at the bottom of the post, unless you need something more? |
Has there been any further movement on this issue? |
This should work as expected and has been demonstrated at http://grdnr.io/inspec-and-chef-compliance-as-code/. Sample code is available here as https://github.com/chris-rock/acme-inspec-profile |
Ok, why is this issue still open, then? I am unable to write a repository that both runs an Inspec profile via kitchen and exports that profile so it can be included by other profiles in other repositories, and I assumed that was in scope of this issue. I can open a new issue if that is not the case. |
@Poohblah Do you have your case somewhere open source? Or a gist where we can see that error? |
I don't have an example ready, but it's pretty straightforward to explain. kitchen-inspec expects a profile to live in |
The ability to have a profile embedded in a cookbook (or other directory structure) exported for inclusion in other profiles as a dependency is not supported, with the exception of the The ability to supply a git repository where the profile is not the only contents and not at the top-level of the repo would be a feature enhancement to InSpec itself. If this feature is needed, please feel free to log an issue at chef/inspec. Thank you! |
I'm not sure if this is a duplicate of #25 but I'm having trouble getting kitchen-inspec to work with profiles.
I have the following directory structure:
My
test/pm-inbound/default_spec.rb
looks like this:inspec seems to work (obviously tests fail here b/c I haven't passed a host):
However, kitchen-inspec won't work:
My
.kitchen.yml
:The text was updated successfully, but these errors were encountered: