capify-ec2 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/capify-ec2.rb +20 -5
- data/lib/capify-ec2/version.rb +1 -1
- metadata +3 -3
data/lib/capify-ec2.rb
CHANGED
@@ -43,6 +43,7 @@ class CapifyEc2
|
|
43
43
|
def self.get_elb_name_by_instance(instance_id)
|
44
44
|
@elb = Fog::AWS::ELB.new(:aws_access_key_id => @ec2_config[:aws_access_key_id], :aws_secret_access_key => @ec2_config[:aws_secret_access_key], :region => @ec2_config[:aws_params][:region])
|
45
45
|
@elb.load_balancers.each do |load_balancer|
|
46
|
+
p load_balancer
|
46
47
|
load_balancer.instances.each {|instance| return load_balancer.id if instance_id == instance}
|
47
48
|
end
|
48
49
|
return nil
|
@@ -55,8 +56,22 @@ class CapifyEc2
|
|
55
56
|
@elb.deregister_instances_from_load_balancer(@instance.id, @elb_name) unless @elb_name.nil?
|
56
57
|
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
def self.register_instance_in_elb
|
60
|
+
return unless @ec2_config[:load_balanced]
|
61
|
+
@elb.register_instances_with_load_balancer(@instance.id, @elb_name) unless @elb_name.nil?
|
62
|
+
state = @elb.describe_instance_health(@elb_name, @instance.id).body['DescribeInstanceHealthResult']['InstanceStates'][0]['State']
|
63
|
+
count = 0
|
64
|
+
sleepcount = 5
|
65
|
+
until (state == 'InService' || count == 6)
|
66
|
+
sleep sleepcount
|
67
|
+
count += 1
|
68
|
+
puts 'Verifying Instance Health'
|
69
|
+
state = @elb.describe_instance_health(@elb_name, @instance.id).body['DescribeInstanceHealthResult']['InstanceStates'][0]['State']
|
70
|
+
end
|
71
|
+
if state == 'InService'
|
72
|
+
puts "#{@instance.tags['Name']}: Healthy"
|
73
|
+
else
|
74
|
+
puts "#{@instance.tags['Name']}: tests timed out after #{count*sleepcount} seconds."
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/capify-ec2/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capify-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 2
|
10
|
+
version: 1.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Noah Cantor
|