Parent

Class/Module Index [+]

Quicksearch

Fog::Compute::Server

Attributes

private_key[W]
private_key_path[W]
public_key[W]
public_key_path[W]
ssh_port[W]
username[W]

Public Instance Methods

private_key() click to toggle source
# File lib/fog/compute/models/server.rb, line 18
def private_key
  @private_key ||= private_key_path && File.read(private_key_path)
end
private_key_path() click to toggle source
# File lib/fog/compute/models/server.rb, line 13
def private_key_path
  @private_key_path ||= Fog.credentials[:private_key_path]
  @private_key_path &&= File.expand_path(@private_key_path)
end
public_key() click to toggle source
# File lib/fog/compute/models/server.rb, line 27
def public_key
  @public_key ||= public_key_path && File.read(public_key_path)
end
public_key_path() click to toggle source
# File lib/fog/compute/models/server.rb, line 22
def public_key_path
  @public_key_path ||= Fog.credentials[:public_key_path]
  @public_key_path &&= File.expand_path(@public_key_path)
end
scp(local_path, remote_path, upload_options = {}) click to toggle source
# File lib/fog/compute/models/server.rb, line 35
def scp(local_path, remote_path, upload_options = {})
  require 'net/scp'
  requires :public_ip_address, :username

  scp_options = {:port => ssh_port}
  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
Also aliased as: scp_upload
scp_download(remote_path, local_path, download_options = {}) click to toggle source
# File lib/fog/compute/models/server.rb, line 46
def scp_download(remote_path, local_path, download_options = {})
  require 'net/scp'
  requires :public_ip_address, :username

  scp_options = {:port => ssh_port}
  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
scp_upload(local_path, remote_path, upload_options = {}) click to toggle source
Alias for: scp
ssh(commands, options={}, &blk) click to toggle source
# File lib/fog/compute/models/server.rb, line 55
def ssh(commands, options={}, &blk)
  require 'net/ssh'
  requires :public_ip_address, :username

  options[:key_data] = [private_key] if private_key
  options[:port] ||= ssh_port
  Fog::SSH.new(public_ip_address, username, options).run(commands, &blk)
end
ssh_port() click to toggle source
# File lib/fog/compute/models/server.rb, line 31
def ssh_port
  @ssh_port ||= 22
end
sshable?(options={}) click to toggle source
# File lib/fog/compute/models/server.rb, line 64
def sshable?(options={})
  ready? && !public_ip_address.nil? && !!Timeout::timeout(8) { ssh('pwd', options) }
rescue SystemCallError, Net::SSH::AuthenticationFailed, Timeout::Error
  false
end
username() click to toggle source
# File lib/fog/compute/models/server.rb, line 9
def username
  @username ||= 'root'
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.