Class: CORL::Machine::Rackspace

Inherits:
FogBase
  • Object
show all
Defined in:
lib/CORL/machine/rackspace.rb

Instance Method Summary collapse

Methods inherited from FogBase

#compute, #compute=, #create, #created?, #destroy, #download, #exec, #image, #images, #load, #machine_type, #machine_types, #normalize, #private_ip, #public_ip, #running?, #server, #server=, #ssh_wait_for_ready, #state, #stop, #terminal, #upload

Methods included from CORL::Mixin::Machine::SSH

#close_ssh_session, #init_ssh_session, #ssh_download, #ssh_exec, #ssh_terminal, #ssh_upload, #ssh_wait_for_ready

Instance Method Details

#create_image(options = {}) ⇒ Object




49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/CORL/machine/rackspace.rb', line 49

def create_image(options = {})
  super do |image_name, config, success|
    image = server.create_image(image_name)
    image.wait_for { ready? }

    if image
      node[:image] = image.id
      success      = true
    end
    success
  end
end

#init_serverObject


Management



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/CORL/machine/rackspace.rb', line 20

def init_server
  super do
    myself.plugin_name = @server.id

    node[:id]           = plugin_name
    node[:public_ip]    = @server.public_ip_address
    node[:private_ip]   = @server.private_ip_address
    node[:machine_type] = @server.flavor.id
    node[:image]        = @server.image.id if @server.image
    node.user           = @server.username unless node.user

    @server.private_key_path = node.private_key if node.private_key
    @server.public_key_path  = node.public_key if node.public_key
  end
end

#reload(options = {}) ⇒ Object




38
39
40
41
42
43
44
45
# File 'lib/CORL/machine/rackspace.rb', line 38

def reload(options = {})
  super do |config|
    success = server.reboot(config.get(:type, 'SOFT'))

    server.wait_for { ready? } if success
    success
  end
end

#set_connectionObject


Property accessors / modifiers



12
13
14
15
# File 'lib/CORL/machine/rackspace.rb', line 12

def set_connection
  super
  Kernel.load File.join(File.dirname(__FILE__), '..', '..', 'core', 'mod', 'fog_rackspace_server.rb')
end