Skip to content
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

Vague error if 'platform' value is missing in platform section and inspec profile platfrom/os-family is set #101

Closed
nvtkaszpir opened this issue Aug 31, 2016 · 5 comments

Comments

@nvtkaszpir
Copy link

nvtkaszpir commented Aug 31, 2016

General info

My inspec profile had platform set to 'all'', while my platform section for debian7 did not specify 'platform' value at all. But on the other hand inspec profile has os-family set.

Thus, when invoking kitchen verify I got error like below:

Failed to complete #verify action: [no implicit conversion of nil into Array]

backtrace goes to /home/kaszpir/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.15.0/lib/kitchen/verifier/inspec.rb:133:in +'`

where line 133 shows:

(local_suite_files + config[:inspec_tests]).compact

After adding some debugging messages I have found out that config[:inspec_tests] is nil

Then I verified platform on inspec profile and in kitchen.yml and they were different (well, actually platfrom was not set for debian in my case)

Steps to reproduce

I believe you can reproduce it with any driver, below is with LXC, also provisioner is rahter not important here.

Proper kitchen.yml - see comments

---
driver_plugin: lxc

driver:
  name: vagrant
  provider: lxc

transport:
  name: sftp # kitchen-sync does not work properly with test-kitchen 1.4.x
  compression_level: 9

provisioner:
  name: puppet_apply
  manifests_path: puppet/manifests
  modules_path: puppet/modules
  hiera_config_path: puppet/hiera.kitchen.yaml # different file mapping than files uploaded by boilerplate
  hiera_data_path: puppet/hiera
  puppet_verbose: true
  require_chef_for_busser: false

verifier:
  name: inspec

platforms:
# https://github.com/fgrehm/vagrant-lxc-base-boxes
# vagrant box add --name debian7lxc --provider lxc vagrant-lxc-wheezy-amd64.box

- name: debian.7-lxc
  platform: debian # without this line it breaks with error [no implicit conversion of nil into Array], so comment this line to the the error for free! :)
  driver:
    box: debian7lxc
  driver_config:
    username: root
    password: root

suites:
  - name: twemproxy
    driver:
    provisioner:
      manifest: twemproxy.pp
    verifier:
      inspec_tests:
        - inspec/twemproxy

inspec file:

name: twemproxy
title: InSpec Profile
maintainer: Michał Sochoń
copyright: Michał Sochoń
copyright_email: [email protected]
license: Apache 2 license
summary: An InSpec Profile for twemproxy node
version: 0.2.0
supports:
  - os-family: debian
    release: 7
  - platform: all

More info

Test Kitchen version 1.11.1
inspec version 0.32.0
kitchen-inspec (0.15.0)

Fix

Generate more sane message if test suite list is empty.

@chris-rock
Copy link
Collaborator

At this point, InSpec supports only ssh, winrm and docker connectivity: https://github.com/chef/kitchen-inspec/blob/master/lib/kitchen/verifier/inspec.rb#L141-L157
We would need to add support for lxc in inspec.

@nvtkaszpir
Copy link
Author

I don't believe the issue is caused by LXC, because I use ssh connections - so this is transparent.
The problem is that if inspec files does not have 'platform' specified, then kitchen fails to find any suitable platforms to perform test.

@chris-rock
Copy link
Collaborator

Can you add a pry shell and verify that we get a transport.is_a?(Kitchen::Transport::Ssh) https://github.com/chef/kitchen-inspec/blob/master/lib/kitchen/verifier/inspec.rb#L141-L157?

@nvtkaszpir
Copy link
Author

ssh works as I said in #66.

http://imgur.com/4yivNHc

@adamleff
Copy link
Contributor

Since the creation of this issue, the logic on how the config[:inspec_tests] value is validated and resolved has changed and I have not been able to reproduce this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants