# File lib/fog/compute/models/server.rb, line 7 def private_key=(key_data) @private_key = key_data end
# File lib/fog/compute/models/server.rb, line 11 def scp(local_path, remote_path, upload_options = {}) require 'net/scp' requires :public_ip_address, :username scp_options = {} scp_options[:key_data] = [private_key] if private_key Fog::SCP.new(public_ip_address, username, scp_options).upload(local_path, remote_path, upload_options) end
# File lib/fog/compute/models/server.rb, line 22 def scp_download(remote_path, local_path, download_options = {}) require 'net/scp' requires :public_ip_address, :username scp_options = {} scp_options[:key_data] = [private_key] if private_key Fog::SCP.new(public_ip_address, username, scp_options).download(remote_path, local_path, download_options) end
# File lib/fog/compute/models/server.rb, line 31 def ssh(commands, options={}, &blk) require 'net/ssh' requires :public_ip_address, :username options[:key_data] = [private_key] if private_key Fog::SSH.new(public_ip_address, username, options).run(commands, &blk) end
# File lib/fog/compute/models/server.rb, line 39 def sshable? ready? && !public_ip_address.nil? && !!Timeout::timeout(8) { ssh 'pwd' } rescue SystemCallError, Net::SSH::AuthenticationFailed, Timeout::Error false end