Skip to content

Instantly share code, notes, and snippets.

@Veraticus
Created February 7, 2014 00:03
Show Gist options
  • Save Veraticus/8855042 to your computer and use it in GitHub Desktop.
Save Veraticus/8855042 to your computer and use it in GitHub Desktop.
begin
puts "Starting begin. Auth methods: #{ssh_options[:auth_methods]}"
connection_options = ssh_options.merge(
:password => password_value,
:auth_methods => ssh_options[:auth_methods] || methods.shift
)
yield host, user, connection_options
rescue Net::SSH::AuthenticationFailed
puts "Methods: #{methods}. ssh_options: #{ssh_options[:auth_methods]}. Raise if: #{methods.empty? || ssh_options[:auth_methods] ? true : false}"
raise if methods.empty? || ssh_options[:auth_methods]
puts "Hit rescue. Auth methods: #{ssh_options[:auth_methods]} Password: #{options[:password]}"
password_value = options[:password]
retry
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment