Class: CloudProviders::SshInstance

Inherits:
CloudProviderInstance show all
Defined in:
lib/cloud_providers/ssh/ssh_instance.rb

Instance Method Summary collapse

Methods inherited from CloudProviderInstance

#[], #[]=, #after_bootstrap, #after_configure, #before_bootstrap, #before_configure, #bootstrap!, #bootstrapped?, #configure!, #determine_os, #each, #elapsed_runtime, #has_key?, #keypair, #keys, #loaded, #on_all_callbacks, #os, #pack_clouds_dot_rb_and_expected_directories, #pending?, #running?, #terminate!, #terminated?, #terminating?, #to_hash, #valid?, #values, #wait_for_port, #wait_for_public_ip

Methods included from Callbacks

included

Methods included from Connections

#host, #rsync, #run, #scp, #ssh, #ssh_options, #user

Constructor Details

#initialize(opts = {}, &block) ⇒ SshInstance

Returns a new instance of SshInstance.



16
17
18
19
# File 'lib/cloud_providers/ssh/ssh_instance.rb', line 16

def initialize(opts={}, &block)
  @host = opts[:name] || name || dns_name
  super
end

Instance Method Details

#cloud_provider(o = {}, &block) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/cloud_providers/ssh/ssh_instance.rb', line 21

def cloud_provider(o={}, &block)
  @cloud_provider ||= if cloud
    cloud.cloud_provider
  else
    options_for_cloud_provider = o.choose{|k,v| Ssh.default_options.has_key?(k)}
    Ssh.new( options_for_cloud_provider, &block)
  end
end

#instance_idObject



12
13
14
# File 'lib/cloud_providers/ssh/ssh_instance.rb', line 12

def instance_id
  self.name
end

#refresh!Object



30
31
32
33
34
35
36
37
38
# File 'lib/cloud_providers/ssh/ssh_instance.rb', line 30

def refresh!
  run 'uptime'
  name(run('hostname'))
  dns_name(name)
  status('running') if name
  # :internal_ip  => nil, # TODO
  # :public_ip    => nil, #TODO
  self
end