Skip to content

Commit

Permalink
Refactor SSH utility to remove redundant retry logic in run method
Browse files Browse the repository at this point in the history
  • Loading branch information
vitobotta committed Jan 26, 2025
1 parent d305ad4 commit bd00683
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/util/ssh.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ class Util::SSH
def initialize(@private_ssh_key_path, @public_ssh_key_path)
end

def run(instance, port, command, use_ssh_agent, print_output = true)
Retriable.retry(max_attempts: 300, backoff: false, base_interval: 1.second, on: {SSH2::SSH2Error, SSH2::SessionError, Socket::ConnectError}) do
run_command(instance, port, command, use_ssh_agent, print_output)
end
end

def wait_for_instance(instance, port, use_ssh_agent, test_command, expected_result, max_attempts : Int16 = 20)
result = nil

Expand All @@ -40,7 +34,7 @@ class Util::SSH
result
end

private def run_command(instance, port, command, use_ssh_agent, print_output = true)
def run(instance, port, command, use_ssh_agent, print_output = true)
host_ip_address = instance.host_ip_address.not_nil!

cmd_file_path = "/tmp/cli_#{Random::Secure.hex(8)}.cmd"
Expand Down

0 comments on commit bd00683

Please sign in to comment.