class Kitsune::Kit::Provisioner
def wait_for_ssh(ip, interval: 5, max_attempts: 24)
def wait_for_ssh(ip, interval: 5, max_attempts: 24) max_attempts.times do |i| begin puts "🔐 Waiting for SSH connection to #{ip}... (#{i + 1}/#{max_attempts})" TCPSocket.new(ip, 22).close puts "🔓 SSH connection to #{ip} established" return rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, SocketError sleep interval end end abort "❌ Could not connect via SSH to #{ip} after #{interval * max_attempts} seconds" end