lib/rye/box.rb in rye-0.5.2 vs lib/rye/box.rb in rye-0.5.3

- old
+ new

@@ -141,19 +141,27 @@ highline = HighLine.new # Used for password prompt retried = 0 begin @ssh = Net::SSH.start(@host, @opts[:user], @opts || {}) + rescue Net::SSH::HostKeyMismatch => ex + STDERR.puts ex.message + STDERR.puts "NOTE: EC2 instances generate new SSH keys on first boot." + if highline.ask("Continue? ").match(/y|yes/i) + @opts[:paranoid] = false + retry + else + raise Net::SSH::HostKeyMismatch + end rescue Net::SSH::AuthenticationFailed => ex retried += 1 if STDIN.tty? && retried <= 3 @opts[:password] = highline.ask("Password: ") { |q| q.echo = '' } @opts[:auth_methods] ||= [] @opts[:auth_methods] << 'password' retry else - STDERR.puts "Authentication failed." - exit 0 + raise Net::SSH::AuthenticationFailed end end # We add :auth_methods (a Net::SSH joint) to force asking for a # password if the initial (key-based) authentication fails. We