Class: Pec::Command::Status
Class Method Summary collapse
- .before_do ⇒ Object
- .flavor_name(server) ⇒ Object
- .ip_addresses(server) ⇒ Object
- .task(host_name, options, server, config) ⇒ Object
- .tenant_name(server) ⇒ Object
Methods inherited from Base
Class Method Details
.before_do ⇒ Object
41 42 43 |
# File 'lib/pec/command/status.rb', line 41 def self.before_do Thor.new.say("Current machine status:", :yellow) end |
.flavor_name(server) ⇒ Object
29 30 31 |
# File 'lib/pec/command/status.rb', line 29 def self.flavor_name(server) Yao::Flavor.get(server.flavor['id']).name end |
.ip_addresses(server) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/pec/command/status.rb', line 33 def self.ip_addresses(server) server.addresses.map do |ethers| ethers[1].map do |ether| ether["addr"] end end.flatten.join(",") end |
.task(host_name, options, server, config) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pec/command/status.rb', line 4 def self.task(host_name, , server, config) if server puts sprintf( " %-35s %-10s %-10s %-10s %-10s %-10s %-35s %-48s", config.name, server.status, tenant_name(server), flavor_name(server), server.availability_zone, server.key_name, server.ext_srv_attr_host, ip_addresses(server) ) else puts sprintf(" %-35s %-10s", config.name, "uncreated" ) end end |
.tenant_name(server) ⇒ Object
25 26 27 |
# File 'lib/pec/command/status.rb', line 25 def self.tenant_name(server) Yao::Tenant.list.find {|tenant| tenant.id == server.tenant_id}.name end |