chef / knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Apache License 2.0
152 stars 110 forks source link

WinRM Connection fails when one node in list is down #402

Closed mtharpe closed 4 years ago

mtharpe commented 8 years ago

When running knife winrm "name:somequery" 'some command' and there is a return from the chef server that has a server that is not available the whole command fails.

/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient/session.rb:604:in initialize': execution expired (HTTPClient::ConnectTimeoutError) from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient/session.rb:604:innew' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient/session.rb:604:in create_socket' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient/session.rb:749:inblock in connect' from /opt/chefdk/embedded/lib/ruby/2.3.0/timeout.rb:101:in timeout' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient/session.rb:742:inconnect' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient/session.rb:504:in query' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient/session.rb:174:inquery' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient.rb:1240:in do_get_block' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient.rb:1017:inblock in do_request' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient.rb:1131:in protect_keep_alive_disconnected' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient.rb:1012:indo_request' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient.rb:854:in request' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/httpclient-2.8.2.4/lib/httpclient.rb:763:inpost' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/http/transport.rb:220:in init_auth' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/http/transport.rb:168:insend_request' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/cmd.rb:56:in open_shell' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:163:inblock in open' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/retryable.rb:37:in retryable' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:161:inopen' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:124:in with_command_shell' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/shells/base.rb:80:inrun' from /Users/mtharpe/.chefdk/gem/ruby/2.3.0/gems/knife-windows-1.7.0/lib/chef/knife/winrm_session.rb:69:in block in relay_command' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/winrm-2.1.0/lib/winrm/connection.rb:43:inshell' from /Users/mtharpe/.chefdk/gem/ruby/2.3.0/gems/knife-windows-1.7.0/lib/chef/knife/winrm_session.rb:67:in relay_command' from /Users/mtharpe/.chefdk/gem/ruby/2.3.0/gems/knife-windows-1.7.0/lib/chef/knife/winrm_knife_base.rb:130:inblock in relay_winrm_command' from /Users/mtharpe/.chefdk/gem/ruby/2.3.0/gems/knife-windows-1.7.0/lib/chef/knife/winrm_knife_base.rb:128:in each' from /Users/mtharpe/.chefdk/gem/ruby/2.3.0/gems/knife-windows-1.7.0/lib/chef/knife/winrm_knife_base.rb:128:inrelay_winrm_command' from /Users/mtharpe/.chefdk/gem/ruby/2.3.0/gems/knife-windows-1.7.0/lib/chef/knife/winrm_knife_base.rb:114:in run_command' from /Users/mtharpe/.chefdk/gem/ruby/2.3.0/gems/knife-windows-1.7.0/lib/chef/knife/winrm.rb:60:inexecute_remote_command' from /Users/mtharpe/.chefdk/gem/ruby/2.3.0/gems/knife-windows-1.7.0/lib/chef/knife/winrm.rb:52:in run' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.15.19/lib/chef/knife.rb:429:inblock in run_with_pretty_exceptions' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.15.19/lib/chef/local_mode.rb:44:in with_server_connectivity' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.15.19/lib/chef/knife.rb:428:inrun_with_pretty_exceptions' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.15.19/lib/chef/knife.rb:219:in run' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.15.19/lib/chef/application/knife.rb:156:inrun' from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.15.19/bin/knife:25:in <top (required)>' from /usr/local/bin/knife:57:inload' from /usr/local/bin/knife:57:in `

'

mtharpe commented 8 years ago

I am able to see that with verbose mode turned on, knife returns a list of hosts. Once that is complete if the list returns hosts that are up first it will work until it hits a node that is not available and the will stop based on the fact that it is not able to connect to that node. This behavior is very different from SSH as if the node is not available with SSH it will continue which is the expected result for WINRM I would think.

Vasu1105 commented 6 years ago

@mtharpe I have added some comments on #445 could you please look at those I think this is the similar issue and let us know if that works for you.

mtharpe commented 6 years ago

@Vasu1105 I will test and verify. Thank you for your response.

mtharpe commented 6 years ago

@Vasu1105 that would appear to work around the issue, but I would not consider that a final solution as that would be drastically different from a feature and use parity with SSH.

Thank you for your help on this!

NAshwini commented 4 years ago

Closing this issue as its been resolved by PR #484