class CORL::Node::AWS
Public Instance Methods
create(options = {})
click to toggle source
Calls superclass method
# File lib/CORL/node/AWS.rb 61 def create(options = {}) 62 super do |op, config| 63 if op == :config 64 config.defaults(create_config) 65 end 66 end 67 end
create_config()
click to toggle source
# File lib/CORL/node/AWS.rb 54 def create_config 55 { :flavor_id => machine_type, :image_id => image, :username => user } 56 end
image_search_text(image)
click to toggle source
# File lib/CORL/node/AWS.rb 105 def image_search_text(image) 106 location = image.location.split('/').first 107 location = location.match(/^\d+$/) ? '' : location 108 sprintf("%s %s %s %s %s %s %s", image_id(image), image.name, image.description, image.state, image.architecture, image.owner_id, location) 109 end
machine_config()
click to toggle source
Calls superclass method
# File lib/CORL/node/AWS.rb 40 def machine_config 41 super do |config| 42 config.import({ 43 :provider => 'AWS', 44 :region => region.to_s 45 }) 46 47 config[:aws_access_key_id] = api_user if api_user 48 config[:aws_secret_access_key] = api_key if api_key 49 end 50 end
normalize(reload)
click to toggle source
Calls superclass method
# File lib/CORL/node/AWS.rb 9 def normalize(reload) 10 super do 11 region_info.import({ 12 'us-east-1' => 'US East -- North Virginia', 13 'us-west-1' => 'US West -- North California', 14 'us-west-2' => 'US West -- Oregon', 15 'eu-west-1' => 'EU -- Ireland', 16 'ap-northeast-1' => 'Asia Pacific -- Tokyo', 17 'ap-southeast-1' => 'Asia Pacific -- Singapore', 18 'ap-southeast-2' => 'Asia Pacific -- Sydney', 19 'sa-east-1' => 'South America -- Sao Paulo' 20 }) 21 22 # Return machine provider 23 :aws 24 end 25 end
render_image(image)
click to toggle source
# File lib/CORL/node/AWS.rb 95 def render_image(image) 96 description = image.name 97 description = image.description if image.description && ! image.description.empty? 98 99 location = image.location.split('/').first 100 sprintf("%-23s [ %-10s | %-6s ] %s ( %s )", purple(image_id(image)), blue(image.state), image.architecture, yellow(description), cyan(location)) 101 end
render_machine_type(machine_type)
click to toggle source
# File lib/CORL/node/AWS.rb 82 def render_machine_type(machine_type) 83 sprintf("%-25s %-50s [ VCPUS: %-5s ] ( RAM: %6sMB | DISK: %8sGB ) ( BITS: %5s )", 84 purple(machine_type_id(machine_type)), 85 yellow(machine_type.name), 86 blue(machine_type.cores.to_s), 87 blue(machine_type.ram.to_s), 88 blue(machine_type.disk.to_s), 89 blue(machine_type.bits.to_s) 90 ) 91 end
start(options = {})
click to toggle source
Calls superclass method
# File lib/CORL/node/AWS.rb 71 def start(options = {}) 72 super do |op, config| 73 if op == :config 74 config.defaults(create_config) 75 end 76 end 77 end
usable_image?(image)
click to toggle source
# File lib/CORL/node/AWS.rb 30 def usable_image?(image) 31 image.state == 'available' && image.name 32 end