Sha256: 2ce435649d03e0d5e5d8b85902ea41f193a00a7ce7a097165915aa1f3bee6f2b
Contents?: true
Size: 979 Bytes
Versions: 11
Compression:
Stored size: 979 Bytes
Contents
module Fog module Compute class AWS class Server def setup(credentials = {}) requires :ssh_ip_address, :username commands = [ %{mkdir .ssh}, %{passwd -l #{username}}, %{echo "#{Fog::JSON.encode(Fog::JSON.sanitize(attributes))}" >> ~/attributes.json} ] if public_key commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys} end tries = 5 sleep_secs = 5 begin Nucleon::Util::SSH.session(ssh_ip_address, username, ssh_port, private_key_path, true) results = Nucleon::Util::SSH.exec(ssh_ip_address, username, commands) rescue Net::SSH::HostKeyMismatch => error error.remember_host! sleep 0.2 reset = true retry rescue Net::SSH::ConnectionTimeout, Net::SSH::Disconnect => error if tries > 1 sleep(sleep_secs) tries -= 1 reset = true retry end end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems