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

Fix default retry_limit #19

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/train-winrm/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ def login_command_for_windows
# @api private
def session(retry_options = {})
@session ||= begin
opts = {
opts = retry_options.merge({
retry_limit: @connection_retries.to_i,
retry_delay: @connection_retry_sleep.to_i,
}.merge(retry_options)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem right to me. The usual order of preference overrides is: global -> ENV -> cmdline -> object -> method call... So that big loses to little. This change means that the options passed to the local session call are overridden by the object's ivars.

Also, a change like this really should have a test confirming the problem ad the fix.


opts[:operation_timeout] = @operation_timeout unless @operation_timeout.nil?
@service = ::WinRM::Connection.new(options.merge(opts))
Expand Down