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

Exception: NoMethodError: undefined method `times' for nil:NilClass #498

Open
suyash-binary opened this issue Mar 24, 2020 · 1 comment
Open
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.

Comments

@suyash-binary
Copy link

suyash-binary commented Mar 24, 2020

Version:

❯ knife --version
Chef Infra Client: 15.7.32

Environment:

Linux 5.3.0-7642-generic (Pop! OS)

Scenario:

Trying to execute some command on windows server using knife winrm

Steps to Reproduce:

knife winrm "name:windows_test_node" "ipconfig" -x "Administrator" -P "password"

Expected Result:

To show output of ipconfig

Actual Result:

ERROR: knife encountered an unexpected error
This may be a bug in the 'winrm' knife command or plugin
Please collect the output of this command with the `-VVV` option before filing a bug report.
Exception: NoMethodError: undefined method `times' for nil:NilClass
@suyash-binary suyash-binary added Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected. labels Mar 24, 2020
@suyash-binary
Copy link
Author

At first I got this error

❯ knife winrm "name:windows_test_node" "ipconfig" -x "Administrator" -P "password"
#<Thread:0x000000000a57cbf0@/opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:471 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
	28: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
	27: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/knife-windows-3.0.6/lib/chef/knife/winrm_knife_base.rb:132:in `block (2 levels) in relay_winrm_command'
	26: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/knife-windows-3.0.6/lib/chef/knife/winrm_knife_base.rb:143:in `run_command_in_thread'
	25: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/knife-windows-3.0.6/lib/chef/knife/winrm_session.rb:67:in `relay_command'
	24: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/connection.rb:42:in `shell'
	23: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/knife-windows-3.0.6/lib/chef/knife/winrm_session.rb:69:in `block in relay_command'
	22: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/base.rb:79:in `run'
	21: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/base.rb:128:in `with_command_shell'
	20: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/base.rb:167:in `open'
	19: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/retryable.rb:35:in `retryable'
	18: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/base.rb:169:in `block in open'
	17: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/cmd.rb:54:in `open_shell'
	16: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/http/transport.rb:168:in `send_request'
	15: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/http/transport.rb:236:in `init_auth'
	14: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:765:in `post'
	13: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:856:in `request'
	12: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in `do_request'
	11: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1133:in `protect_keep_alive_disconnected'
	10: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in `block in do_request'
	 9: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1242:in `do_get_block'
	 8: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:177:in `query'
	 7: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:511:in `query'
	 6: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:748:in `connect'
	 5: from /opt/chefdk/embedded/lib/ruby/2.6.0/timeout.rb:103:in `timeout'
	 4: from /opt/chefdk/embedded/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
	 3: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:755:in `block in connect'
	 2: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:611:in `create_socket'
	 1: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:611:in `new'
/opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:611:in `initialize': getaddrinfo: Temporary failure in name resolution (SocketError)
	27: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
	26: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/knife-windows-3.0.6/lib/chef/knife/winrm_knife_base.rb:132:in `block (2 levels) in relay_winrm_command'
	25: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/knife-windows-3.0.6/lib/chef/knife/winrm_knife_base.rb:143:in `run_command_in_thread'
	24: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/knife-windows-3.0.6/lib/chef/knife/winrm_session.rb:67:in `relay_command'
	23: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/connection.rb:42:in `shell'
	22: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/knife-windows-3.0.6/lib/chef/knife/winrm_session.rb:69:in `block in relay_command'
	21: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/base.rb:79:in `run'
	20: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/base.rb:128:in `with_command_shell'
	19: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/base.rb:167:in `open'
	18: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/retryable.rb:35:in `retryable'
	17: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/base.rb:169:in `block in open'
	16: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/shells/cmd.rb:54:in `open_shell'
	15: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/http/transport.rb:168:in `send_request'
	14: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/winrm-2.3.4/lib/winrm/http/transport.rb:236:in `init_auth'
	13: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:765:in `post'
	12: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:856:in `request'tesT@123456
	11: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in `do_request'
	10: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1133:in `protect_keep_alive_disconnected'
	 9: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in `block in do_request'
	 8: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient.rb:1242:in `do_get_block'
	 7: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:177:in `query'
	 6: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:511:in `query'
	 5: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:748:in `connect'
	 4: from /opt/chefdk/embedded/lib/ruby/2.6.0/timeout.rb:103:in `timeout'
	 3: from /opt/chefdk/embedded/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
	 2: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:755:in `block in connect'
	 1: from /opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:607:in `create_socket'
/opt/chefdk/embedded/lib/ruby/gems/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:625:in `rescue in create_socket': getaddrinfo: Temporary failure in name resolution (WIN-94CI04GOPE0:5985) (SocketError)
ERROR: Network Error: getaddrinfo: Temporary failure in name resolution (WIN-94CI04GOPE0:5985)

Later I tried to install knife-windows and then I started to get error as mentioned in title

/opt/chefdk/embedded/bin/gem install knife-windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

1 participant