Skip to content

Commit

Permalink
Merge pull request #2918 from rackspace/setup_disconnect
Browse files Browse the repository at this point in the history
[rackspace|compute] Updated setup method to retry once on disconnect
  • Loading branch information
Kyle Rames committed May 14, 2014
2 parents 5aa2261 + ec6f12f commit 52a4736
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/fog/rackspace/models/compute_v2/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,8 @@ def change_admin_password(password)
def setup(credentials = {})
requires :ssh_ip_address, :identity, :public_key, :username

retried_disconnect = false

commands = [
%{mkdir .ssh},
%{echo "#{public_key}" >> ~/.ssh/authorized_keys},
Expand All @@ -585,6 +587,14 @@ def setup(credentials = {})
rescue Errno::ECONNREFUSED
sleep(1)
retry
# Ubuntu 12.04 images seem to be disconnecting during the ssh setup process.
# This rescue block is an effort to address that issue.
rescue Net::SSH::Disconnect
unless retried_disconnect
retried_disconnect = true
sleep(1)
retry
end
end

def virtual_interfaces
Expand Down

0 comments on commit 52a4736

Please sign in to comment.