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

kitchen verify fails on Windows #57

Closed
aarsan opened this issue Feb 24, 2016 · 8 comments
Closed

kitchen verify fails on Windows #57

aarsan opened this issue Feb 24, 2016 · 8 comments
Labels
Type: Bug Doesn't work as expected.

Comments

@aarsan
Copy link

aarsan commented Feb 24, 2016

I have the latest ChefDK installed and installed kitchen-inspec via "chef gem install kitchen-inspec".

When I run kitchen verify, I get the following error:

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #verify action: [undefined method `endpoint' for nil:NilClass]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

I'm running Test Kitchen on Windows 10 and the machine I am trying to test is Windows 2012 R2.

@stuartpreston
Copy link

In case it helps, I got further with this by updating winrm, winrm-s, inspec and test-kitchen to the latest versions:

*** LOCAL GEMS ***

winrm (1.7.2, 1.7.0)
winrm-fs (0.3.1)
winrm-s (0.3.6, 0.3.5, 0.3.4)
winrm-transport (1.0.3)

*** LOCAL GEMS ***

winrm-s (0.3.6, 0.3.5, 0.3.4)

However I now get a undefined method `encoding'
for nil:NilClass
when attempting to verify via WinRM

C:\Users\stp39\bss>kitchen verify -l debug
-----> Starting Kitchen (v1.5.0)
D      Winrm Transport requested, loading WinRM::Transport gem (["~> 1.0", ">= 1
.0.3"])
D      WinRM::Transport library loaded
D      The winrm-s gem is being loaded to enable sspiauthentication.
D      winrm-s is loaded.  sspinegotiate auth is now available.
-----> Verifying <bss-windows2008>...
       Search `C:/Users/stp39/bss/test/integration/bss` for tests
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #verify action: [undefined method `encoding'
for nil:NilClass]
>>>>>> ----------------------
>>>>>> 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: [undefined method `encoding'
for nil:NilClass]
D      ---Nested Exception---
D      Class: NoMethodError
D      Message: undefined method `encoding' for nil:NilClass
D      ------Backtrace-------
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rubyntlm-0.6.0/lib/ne
t/ntlm/encode_util.rb:42:in `encode_utf16le'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rubyntlm-0.6.0/lib/ne
t/ntlm/client/session.rb:187:in `oem_or_unicode_str'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rubyntlm-0.6.0/lib/ne
t/ntlm/client/session.rb:172:in `password'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rubyntlm-0.6.0/lib/ne
t/ntlm/client/session.rb:192:in `ntlmv2_hash'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rubyntlm-0.6.0/lib/ne
t/ntlm/client/session.rb:196:in `calculate_user_session_key!'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rubyntlm-0.6.0/lib/ne
t/ntlm/client/session.rb:27:in `authenticate!'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/rubyntlm-0.6.0/lib/ne
t/ntlm/client.rb:36:in `init_context'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/http/transport.rb:228:in `init_auth'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/http/transport.rb:166:in `send_request'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/winrm_service.rb:489:in `send_message'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/winrm_service.rb:390:in `run_wql'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/command_executor.rb:171:in `os_version'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/command_executor.rb:130:in `code_page'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/command_executor.rb:72:in `block in open'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/command_executor.rb:203:in `retryable'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/command_executor.rb:71:in `open'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/winrm-1.7.2/lib/w
inrm/winrm_service.rb:356:in `create_executor'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.1/li
b/train/transports/winrm_connection.rb:176:in `session'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.1/li
b/train/transports/winrm_connection.rb:64:in `run_command'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.1/li
b/train/extras/os_detect_windows.rb:13:in `detect_windows'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.1/li
b/train/extras/os_common.rb:107:in `detect_family_type'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.1/li
b/train/extras/os_common.rb:80:in `detect_family'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.1/li
b/train/extras/os_common.rb:26:in `initialize'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.1/li
b/train/transports/winrm_connection.rb:190:in `initialize'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.1/li
b/train/transports/winrm_connection.rb:52:in `new'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/r-train-0.10.1/li
b/train/transports/winrm_connection.rb:52:in `os'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/resources/os.rb:17:in `block (2 levels) in <class:OS>'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/resources/port.rb:36:in `initialize'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/plugins/resource.rb:34:in `initialize'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/resource.rb:27:in `new'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/resource.rb:27:in `block (3 levels) in create_dsl'
D      C:/Users/stp39/bss/test/integration/bss/bss_spec.rb:1:in `load'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/profile_context.rb:34:in `instance_eval'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/profile_context.rb:34:in `load'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/runner.rb:86:in `add_content'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/runner.rb:60:in `block in add_profile'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/runner.rb:57:in `each'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/runner.rb:57:in `add_profile'
D      C:/Users/stp39/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.14.5/lib
/inspec/runner.rb:67:in `add_target'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.12.2
/lib/kitchen/verifier/inspec.rb:43:in `block in call'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.12.2
/lib/kitchen/verifier/inspec.rb:43:in `each'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/kitchen-inspec-0.12.2
/lib/kitchen/verifier/inspec.rb:43:in `call'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/instance.rb:405:in `block in verify_action'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/instance.rb:495:in `call'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/instance.rb:495:in `synchronize_or_call'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/instance.rb:460:in `block in action'
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.5.0/li
b/kitchen/instance.rb:459:in `action'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/instance.rb:401:in `verify_action'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/instance.rb:348:in `block in transition_to'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/instance.rb:347:in `each'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/instance.rb:347:in `transition_to'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/instance.rb:160:in `verify'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/command.rb:176:in `public_send'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/test-kitchen-1.5.0/li
b/kitchen/command.rb:176:in `block (2 levels) in run_action'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/logging-2.0.0/lib/log
ging/diagnostic_context.rb:448:in `call'
D      C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/logging-2.0.0/lib/log
ging/diagnostic_context.rb:448:in `block in create_with_logging_context'
D      ----------------------

@chris-rock
Copy link
Collaborator

Hi @aarsan and @stuartpreston Could you try the latest test-kitchen 1.6 and the latest kitchen-inspec. It uses the same winrm library under the hood, therefore it should work as expected. Please let me know if this issue persists with the latest versions

@chris-rock chris-rock changed the title kitchen verify fails kitchen verify fails on Windows Mar 1, 2016
@chris-rock chris-rock added the bug label Mar 1, 2016
@stuartpreston
Copy link

With TK 1.6 and kitchen-inspec 0.12.3 I get much further, past the problems with the legacy driver and it now appears to behave the same way as the rest of the winrm tooling... Good job!

Unfortunately I'm having issues doing sspi negotiate in a Windows domain environment though and test-kitchen/test-kitchen#957 is tracking the issues related to this. (currently a username and password is required to be specified to be able to do negotiate auth).

Then I hit the 'port' resource doesn't work correctly on Windows 2008 R2, becuase the Get-NetTCPConnection cmdlet doesn't exist there by default:

My code:

describe port(5985) do
  it { should be_listening }
end
[wt001466]: PS C:\Users\stp39\appdata\Local\Temp> Get-NetTCPConnection | Select-Object -Property State, Caption, Descrip
tion, LocalAddress, LocalPort, RemoteAddress, RemotePort, DisplayName, Status | ConvertTo-Json
The term 'Get-NetTCPConnection' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    + CategoryInfo          :
    + FullyQualifiedErrorId : CommandNotFoundException

I'll use the command resource as a workaround.

@chris-rock
Copy link
Collaborator

Regarding the sspi negotiate, I assume we do not transfer the all parameters in https://github.com/chef/kitchen-inspec/blob/master/lib/kitchen/verifier/inspec.rb#L175. Need to double check that.

The port fix is on the way: inspec/inspec#488

@chris-rock
Copy link
Collaborator

@mwrock do you have an idea?

@mwrock
Copy link
Contributor

mwrock commented Mar 8, 2016

Yes we dealt with the SSPINegotiate issue in test-kitchen/test-kitchen#957. The credentials are currently required.

@stuartpreston
Copy link

Agreed. I'm unblocked for now but storing a username and password.

@chris-rock
Copy link
Collaborator

I close this for now. If it stays an issue, please reopen

@tas50 tas50 added Type: Bug Doesn't work as expected. and removed bug labels Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Doesn't work as expected.
Projects
None yet
Development

No branches or pull requests

5 participants