forked from auser/poolparty
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcloud-show
executable file
·55 lines (40 loc) · 1.57 KB
/
cloud-show
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../lib")
require "poolparty"
require 'git-style-binary/command'
GitStyleBinary.command do
@theme = :short
version "PoolParty #{$0} command"
banner <<-EOS
Usage: #{$0} #{all_options_string}
shows output about the clouds.rb
EOS
short_desc "shows output about the clouds.rb"
run do |command|
@loaded_clouds.each do |cld|
msg = [
"Cloud: #{cld.name}",
"----------------------------",
"Running Instances: #{cld.nodes.size}",
"Minimum instances: #{cld.minimum_instances}",
"Maximum instances: #{cld.maximum_instances}",
"Running on: #{cld.cloud_provider.name}",
"Keypair: #{cld.keypair.basename}",
"Security group: #{cld.cloud_provider.security_group_names.join(', ')}",
"Availability zones: #{cld.cloud_provider.availability_zones.join(', ')}",
"User: #{cld.user}",
"Active recipes: #{cld.chef._recipes(cld.pool.chef_step).join ", " }"
]
if cld.load_balancers.size > 0
load_balancers = cld.cloud_provider.load_balancers.first.running_load_balancers.map {|a| a[:dns_name]}
msg << "Load balancers: #{load_balancers.join("\n\t\t\t")}"
end
if cld.rds_instances.size > 0
available = cld.cloud_provider.available_rds_instances.map{|r| "#{r.instance_id}\t#{r.current_status.Endpoint.Address}" }
available.unshift 'RDS Instances:'
msg << available.join("\n\t\t\t")
end
puts msg.flatten
end
end
end