Class: Ironfan::Provider::Static::Machine
- Inherits:
-
IaasProvider::Machine
- Object
- Resource
- IaasProvider::Machine
- Ironfan::Provider::Static::Machine
- Defined in:
- lib/ironfan/headers.rb,
lib/ironfan/provider/static/machine.rb
Class Method Summary collapse
-
.block_device_mapping(computer) ⇒ Object
An array of hashes with dorky-looking keys, just like Fog wants it.
-
.create!(computer) ⇒ Object
Manipulation.
- .destroy!(computer) ⇒ Object
- .expected_ids(computer) ⇒ Object
- .launch_description(computer) ⇒ Object
- .lint(computer) ⇒ Object
-
.load!(cluster = nil) ⇒ Object
Discovery.
- .multiple? ⇒ Boolean
- .resource_type ⇒ Object
- .save!(computer) ⇒ Object
- .shared? ⇒ Boolean
-
.validate_resources!(computers) ⇒ Object
Find active machines that haven’t matched, but should have, make sure all bogus machines have a computer to attach to for display purposes.
Instance Method Summary collapse
- #availability_zone ⇒ Object
- #created? ⇒ Boolean
- #created_at ⇒ Object
- #destroy ⇒ Object
- #dns_name ⇒ Object
- #error? ⇒ Boolean
- #flavor_id ⇒ Object
- #flavor_name ⇒ Object
- #groups ⇒ Object
- #image_id ⇒ Object
- #key_name ⇒ Object
- #keypair ⇒ Object
- #name ⇒ Object
- #pending? ⇒ Boolean
- #perform_after_launch_tasks? ⇒ Boolean
- #private_ip_address ⇒ Object
- #public_hostname ⇒ Object
- #public_ip_address ⇒ Object
- #running? ⇒ Boolean
- #ssh_key ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #stopped? ⇒ Boolean
- #stopping? ⇒ Boolean
- #tags ⇒ Object
- #to_display(style, values = {}) ⇒ Object
- #to_s ⇒ Object
- #vpc_id ⇒ Object
Methods inherited from IaasProvider::Machine
Class Method Details
.block_device_mapping(computer) ⇒ Object
An array of hashes with dorky-looking keys, just like Fog wants it.
173 174 175 |
# File 'lib/ironfan/provider/static/machine.rb', line 173 def self.block_device_mapping(computer) [] end |
.create!(computer) ⇒ Object
Manipulation
154 155 156 |
# File 'lib/ironfan/provider/static/machine.rb', line 154 def self.create!(computer) nil end |
.destroy!(computer) ⇒ Object
177 178 179 180 181 182 |
# File 'lib/ironfan/provider/static/machine.rb', line 177 def self.destroy!(computer) return unless computer.machine? forget computer.machine.name computer.machine.destroy computer.machine.reload # show the node as shutting down end |
.expected_ids(computer) ⇒ Object
9 |
# File 'lib/ironfan/provider/static/machine.rb', line 9 def self.expected_ids(computer) [computer.server.full_name]; end |
.launch_description(computer) ⇒ Object
168 169 170 |
# File 'lib/ironfan/provider/static/machine.rb', line 168 def self.launch_description(computer) nil end |
.lint(computer) ⇒ Object
159 160 161 162 163 164 165 166 |
# File 'lib/ironfan/provider/static/machine.rb', line 159 def self.lint(computer) cloud = computer.server.cloud(:static) info = [computer.name, cloud.inspect] errors = {} server_errors = computer.server.lint errors["No Private IP"] = info if cloud.private_ip.blank? errors end |
.load!(cluster = nil) ⇒ Object
Discovery
124 125 126 127 128 129 130 131 |
# File 'lib/ironfan/provider/static/machine.rb', line 124 def self.load!(cluster=nil) cluster.facets.each do |facet| facet.servers.each do |server| machine = new(:adaptee => server) remember machine end end end |
.multiple? ⇒ Boolean
7 |
# File 'lib/ironfan/provider/static/machine.rb', line 7 def self.multiple?() false; end |
.resource_type ⇒ Object
8 |
# File 'lib/ironfan/provider/static/machine.rb', line 8 def self.resource_type() :machine; end |
.save!(computer) ⇒ Object
184 185 186 187 188 |
# File 'lib/ironfan/provider/static/machine.rb', line 184 def self.save!(computer) return unless computer.machine? return unless computer.created? nil end |
.shared? ⇒ Boolean
6 |
# File 'lib/ironfan/provider/static/machine.rb', line 6 def self.shared?() false; end |
.validate_resources!(computers) ⇒ Object
Find active machines that haven’t matched, but should have,
make sure all bogus machines have a computer to attach to
for display purposes
136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/ironfan/provider/static/machine.rb', line 136 def self.validate_resources!(computers) recall.each_value do |machine| next unless machine.users.empty? and machine.name if machine.name.match("^#{computers.cluster.name}-") machine.bogus << :unexpected_machine end next unless machine.bogus? fake = Ironfan::Broker::Computer.new fake[:machine] = machine fake.name = machine.name machine.users << fake computers << fake end end |
Instance Method Details
#availability_zone ⇒ Object
109 110 111 |
# File 'lib/ironfan/provider/static/machine.rb', line 109 def availability_zone 'none' end |
#created? ⇒ Boolean
45 46 47 |
# File 'lib/ironfan/provider/static/machine.rb', line 45 def created? false end |
#created_at ⇒ Object
21 22 23 |
# File 'lib/ironfan/provider/static/machine.rb', line 21 def created_at nil end |
#destroy ⇒ Object
113 114 |
# File 'lib/ironfan/provider/static/machine.rb', line 113 def destroy end |
#dns_name ⇒ Object
41 |
# File 'lib/ironfan/provider/static/machine.rb', line 41 def dns_name ; public_ip_address ; end |
#error? ⇒ Boolean
62 63 64 |
# File 'lib/ironfan/provider/static/machine.rb', line 62 def error? false end |
#flavor_id ⇒ Object
25 26 27 |
# File 'lib/ironfan/provider/static/machine.rb', line 25 def flavor_id return nil end |
#flavor_name ⇒ Object
29 30 31 |
# File 'lib/ironfan/provider/static/machine.rb', line 29 def flavor_name "nil" end |
#groups ⇒ Object
37 |
# File 'lib/ironfan/provider/static/machine.rb', line 37 def groups ; [] ; end |
#image_id ⇒ Object
33 34 35 |
# File 'lib/ironfan/provider/static/machine.rb', line 33 def image_id "none" end |
#key_name ⇒ Object
101 102 103 |
# File 'lib/ironfan/provider/static/machine.rb', line 101 def key_name keypair end |
#keypair ⇒ Object
43 |
# File 'lib/ironfan/provider/static/machine.rb', line 43 def keypair ; adaptee.cloud(:static).keypair ; end |
#name ⇒ Object
11 |
# File 'lib/ironfan/provider/static/machine.rb', line 11 def name() adaptee.full_name; end |
#pending? ⇒ Boolean
48 49 50 |
# File 'lib/ironfan/provider/static/machine.rb', line 48 def pending? false end |
#perform_after_launch_tasks? ⇒ Boolean
72 73 74 |
# File 'lib/ironfan/provider/static/machine.rb', line 72 def perform_after_launch_tasks? true end |
#private_ip_address ⇒ Object
105 106 107 |
# File 'lib/ironfan/provider/static/machine.rb', line 105 def private_ip_address adaptee.cloud(:static).private_ip end |
#public_hostname ⇒ Object
39 |
# File 'lib/ironfan/provider/static/machine.rb', line 39 def public_hostname ; adaptee.cloud(:static).public_hostname || public_ip_address ; end |
#public_ip_address ⇒ Object
40 |
# File 'lib/ironfan/provider/static/machine.rb', line 40 def public_ip_address ; adaptee.cloud(:static).public_ip || private_ip_address ; end |
#running? ⇒ Boolean
51 52 53 |
# File 'lib/ironfan/provider/static/machine.rb', line 51 def running? true end |
#ssh_key ⇒ Object
97 98 99 |
# File 'lib/ironfan/provider/static/machine.rb', line 97 def ssh_key keypair = cloud.keypair || computer.server.cluster_name end |
#start ⇒ Object
66 67 |
# File 'lib/ironfan/provider/static/machine.rb', line 66 def start end |
#stop ⇒ Object
69 70 |
# File 'lib/ironfan/provider/static/machine.rb', line 69 def stop end |
#stopped? ⇒ Boolean
58 59 60 |
# File 'lib/ironfan/provider/static/machine.rb', line 58 def stopped? false end |
#stopping? ⇒ Boolean
54 55 56 |
# File 'lib/ironfan/provider/static/machine.rb', line 54 def stopping? false end |
#tags ⇒ Object
12 13 14 15 |
# File 'lib/ironfan/provider/static/machine.rb', line 12 def t = {"Name" => @adaptee.name} return t.keys.inject({}) {|h,k| h[k]=t[k]; h[k.to_sym]=t[k]; h} end |
#to_display(style, values = {}) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/ironfan/provider/static/machine.rb', line 76 def to_display(style,values={}) # style == :minimal values["State"] = "???" values["MachineID"] = private_ip_address values["Public IP"] = private_ip_address values["Private IP"] = public_ip_address values["Created On"] = "???" return values if style == :minimal # style == :default values["Flavor"] = nil values["AZ"] = nil return values if style == :default # style == :expanded values["Image"] = "none" #values["Volumes"] = volumes.map(&:id).join(', ') values["SSH Key"] = "none" values end |
#to_s ⇒ Object
116 117 118 119 |
# File 'lib/ironfan/provider/static/machine.rb', line 116 def to_s "<%-15s %-12s %-25s %-25s %-15s %-15s %-12s %-12s %s:%s>" % [ self.class.handle, "", created_at, name, private_ip_address, public_ip_address, flavor_name, availability_zone, key_name, groups.join(',') ] end |
#vpc_id ⇒ Object
17 18 19 |
# File 'lib/ironfan/provider/static/machine.rb', line 17 def vpc_id return nil end |