Created
December 22, 2010 22:47
-
-
Save zackchandler/752230 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'timeout' | |
def block_until_instance_is_sshable!(timeout=120) | |
start = Time.now | |
while ((Time.now - start) < timeout) do | |
begin | |
Timeout::timeout(5) { | |
# INSERT CODE HERE TO TRY TO SSH | |
return true | |
} | |
rescue Timeout::Error | |
next | |
end | |
end | |
false | |
end | |
result = block_until_instance_is_sshable!(10) | |
puts result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment