Skip to content

Commit

Permalink
Merge pull request #57 from akuma12/master
Browse files Browse the repository at this point in the history
Add Net::SSH::Exception to list of caught SSH errors
  • Loading branch information
Patrick Robinson committed Jul 1, 2021
2 parents 1755264 + 03d4250 commit 194d0bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/ami_spec/wait_for_ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def self.wait(ip_address, user, key, max_retries)
while retries < max_retries
begin
Net::SSH.start(ip_address, user, keys: [key], :verify_host_key => :never) { |ssh| ssh.exec 'echo boo!' }
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Timeout::Error => error
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Timeout::Error, Net::SSH::Exception => error
last_error = error
sleep 1
else
Expand Down
2 changes: 1 addition & 1 deletion spec/wait_for_ssh_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

it 'returns the last error' do
expect(Net::SSH).to receive(:start).and_raise(Errno::ECONNREFUSED, 'some other error')
expect(Net::SSH).to receive(:start).and_raise(Net::SSH::ConnectionTimeout, 'some other error')
expect{subject}.to raise_error(AmiSpec::InstanceConnectionTimeout, /ssh failed/)
end

Expand Down

0 comments on commit 194d0bf

Please sign in to comment.