CenturyLinkCloud / chef-provisioning-vsphere

A chef-provisioning provisioner for VMware vSphere
MIT License
66 stars 57 forks source link

Unable to run "kitchen verify" using inspec thorugh ssh #76

Open warp3r opened 8 years ago

warp3r commented 8 years ago

Hi there,

we are running some test kitchen machines via the vsphere provider with the following configuration

platforms:
  - name: sles-11.3
    transport: 
      username: xxxx
      password: xxxx
      port: 22
      ssh_key:  ~/xxxx.pem
    driver:
      name: vsphere
      driver_options:
        host: '1.2.3.4'
        user: 'xxxx'
        password: 'xxxx'
        insecure: true
      machine_options:
          start_timeout: 600
          create_timeout: 600
          ready_timeout: 600
          bootstrap_options:
            use_linked_clone: true
            datacenter: 'PoC'
            template_folder: 'xxx/Templates'
            template_name: 'TPL_xxx'
            vm_folder: 'xxxx'
            num_cpus: 2,
            network_name: 
            - xxxx
            memory_mb: 4096
            ssh:
              user: xxx
              paranoid: false
              password: xxxx
              port: 22
            customization_spec:
              domain: local
              org_name: 'xxx'
              ipsettings:
                ip: 10.10.1.235
                subnetMask: 255.255.255.0
                gateway: 
                  - 10.10.1.1
                dnsServerList:
                  - 10.10.1.2

and it fails with:

D      Initialize InSpec
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #verify action: [Transport error, can't connect to 'ssh' backend: SSH session could n
ot be established]
>>>>>> ----------------------
>>>>>> 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: Failed to complete #verify action: [Transport error, can't connect to 'ssh' backend: SSH session could n
ot be established]
D      ---Nested Exception---
D      Class: RuntimeError
D      Message: Transport error, can't connect to 'ssh' backend: SSH session could not be established
D      ------Backtrace-------
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/inspec-0.22.0/lib/inspec/backend.rb:44:in `rescue in create'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/inspec-0.22.0/lib/inspec/backend.rb:16:in `create'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/inspec-0.22.0/lib/inspec/runner.rb:45:in `configure_transport
'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/inspec-0.22.0/lib/inspec/runner.rb:29:in `initialize'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.13.0/lib/kitchen/verifier/inspec.rb:43:in `n
ew'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.13.0/lib/kitchen/verifier/inspec.rb:43:in `c
all'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:423:in `block in v
erify_action'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:513:in `call'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:513:in `synchroniz
e_or_call'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:478:in `block in a
ction'
D      C:/opscode/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:477:in `action'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:415:in `verify_act
ion'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:348:in `block in t
ransition_to'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:347:in `each'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:347:in `transition
_to'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/instance.rb:160:in `verify'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/command.rb:176:in `public_send
'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.8.0/lib/kitchen/command.rb:176:in `block (2 le
vels) in run_action'
D      ----------------------

we've tried several approaches when specifying the ssh credentials, but none of them seems to work.

We have another test with windows machines that work wonderfully and also the test for linux using kitchen-ec2 works fine.

Has anybody managed to get kitchen-vsphere to run an inspec test successfully?

thanks for your help!

josh-barker commented 7 years ago

Hi @warp3r I haven't had any issues with using Kitchen+InSpec on Windows and Redhat. I'm using Test Kitchen version 1.15.0 and don't have a transport section defined.

jalberti commented 7 years ago

See https://github.com/chef/train/issues/129 and patch https://github.com/chef/train/pull/183