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
|
# File 'lib/capistrano/asgroup.rb', line 11
def asgroupname(which, *args)
@as_api ||= RightAws::AsInterface.new(fetch(:aws_access_key_id), fetch(:aws_secret_access_key), {})
@ec2_api ||= RightAws::Ec2.new(fetch(:aws_access_key_id), fetch(:aws_secret_access_key), {})
@autoScaleDesc = @as_api.describe_auto_scaling_groups
@ec2DescInst = @ec2_api.describe_instances
@autoScaleDesc.each do |asGroup|
if asGroup[:auto_scaling_group_name] == which or asGroup[:auto_scaling_group_name].scan("-#{which}-").length > 0
asGroup[:instances].each do |asInstance|
@ec2DescInst.delete_if{|i| i[:aws_state] != "running"}.each do |instance|
if instance[:aws_instance_id] == asInstance[:instance_id]
puts "AS Instance ID: #{asInstance[:instance_id]} DNS: #{instance[:dns_name]}"
server(instance[:dns_name], *args)
end
end
end
end
end
end
|