ruby_aem_aws 1.3.0 → 1.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2119ea82ad020763efc3509aeb665994a52deed4
4
- data.tar.gz: 5f497699aca45316d69e62a864d95e30fb7df1db
3
+ metadata.gz: 143bcd08d3dcf1d4bf7955a43031c7734b5048c9
4
+ data.tar.gz: 7b61a8d54896d4021158fd9ce0dce4c50bb05264
5
5
  SHA512:
6
- metadata.gz: 65a7e1bc47342df6ddc07f23e54d7b75f347264c9d8b69592caef796a49ac88f23b85a0564c006eea8393dd8458d5b98c8199ce82c863edf92fa98a0a60ae613
7
- data.tar.gz: 40ff794bd6ecd741d1c4f19ac1c00555a49e1f5ff5103f5399c8b1004b3e25b1d4b283549ff63e45fd1f02188ec82f9a370178d257ac399cc6ea998a47645e19
6
+ metadata.gz: 2a3c723d12b9cbb095f175b8503300e997ff980374355170fb51acb6d10101c298f271577f6ed4847954c4fe2b326ac3f61f9582e73d33c42ed1a288dcfabe70
7
+ data.tar.gz: 4d25ad2d48f49ad2cc1d87f2492f2d112d7c5625f385210eb770524f1a9130df0e20eb3331c914469a69fd5220e49374c6cf5af8d00a85c2afdfbda17fbe8f94
@@ -1 +1 @@
1
- version: 1.3.0
1
+ version: 1.4.0
@@ -14,6 +14,7 @@
14
14
 
15
15
  require_relative '../abstract/grouped_component'
16
16
  require_relative '../abstract/snapshot'
17
+ require_relative '../constants'
17
18
  require_relative '../mixins/healthy_resource_verifier'
18
19
  require_relative '../mixins/metric_verifier'
19
20
  require_relative 'component_descriptor'
@@ -56,7 +57,7 @@ module RubyAemAws
56
57
 
57
58
  def terminate_all_instances
58
59
  get_all_instances.each do |i|
59
- next if i.nil?
60
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
60
61
 
61
62
  i.terminate
62
63
  i.wait_until_terminated
@@ -72,7 +73,7 @@ module RubyAemAws
72
73
  def get_tags
73
74
  tags = []
74
75
  get_all_instances.each do |i|
75
- next if i.nil?
76
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
76
77
 
77
78
  tags.push(i.tags)
78
79
  end
@@ -14,6 +14,7 @@
14
14
 
15
15
  require_relative '../abstract/grouped_component'
16
16
  require_relative '../abstract/snapshot'
17
+ require_relative '../constants'
17
18
  require_relative '../mixins/healthy_resource_verifier'
18
19
  require_relative '../mixins/metric_verifier'
19
20
  require_relative '../mixins/snapshot_verifier'
@@ -50,7 +51,7 @@ module RubyAemAws
50
51
 
51
52
  def terminate_all_instances
52
53
  get_all_instances.each do |i|
53
- next if i.nil?
54
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
54
55
 
55
56
  i.terminate
56
57
  i.wait_until_terminated
@@ -66,7 +67,7 @@ module RubyAemAws
66
67
  def get_tags
67
68
  tags = []
68
69
  get_all_instances.each do |i|
69
- next if i.nil?
70
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
70
71
 
71
72
  tags.push(i.tags)
72
73
  end
@@ -14,6 +14,7 @@
14
14
 
15
15
  require_relative '../abstract/grouped_component'
16
16
  require_relative '../abstract/snapshot'
17
+ require_relative '../constants'
17
18
  require_relative '../mixins/healthy_resource_verifier'
18
19
  require_relative '../mixins/metric_verifier'
19
20
  require_relative '../mixins/snapshot_verifier'
@@ -50,7 +51,7 @@ module RubyAemAws
50
51
 
51
52
  def terminate_all_instances
52
53
  get_all_instances.each do |i|
53
- next if i.nil?
54
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
54
55
 
55
56
  i.terminate
56
57
  i.wait_until_terminated
@@ -66,7 +67,7 @@ module RubyAemAws
66
67
  def get_tags
67
68
  tags = []
68
69
  get_all_instances.each do |i|
69
- next if i.nil?
70
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
70
71
 
71
72
  tags.push(i.tags)
72
73
  end
@@ -14,6 +14,7 @@
14
14
 
15
15
  require_relative '../abstract/grouped_component'
16
16
  require_relative '../abstract/snapshot'
17
+ require_relative '../constants'
17
18
  require_relative '../mixins/healthy_resource_verifier'
18
19
  require_relative '../mixins/metric_verifier'
19
20
  require_relative '../mixins/snapshot_verifier'
@@ -50,7 +51,7 @@ module RubyAemAws
50
51
 
51
52
  def terminate_all_instances
52
53
  get_all_instances.each do |i|
53
- next if i.nil?
54
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
54
55
 
55
56
  i.terminate
56
57
  i.wait_until_terminated
@@ -66,7 +67,7 @@ module RubyAemAws
66
67
  def get_tags
67
68
  tags = []
68
69
  get_all_instances.each do |i|
69
- next if i.nil?
70
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
70
71
 
71
72
  tags.push(i.tags)
72
73
  end
@@ -14,6 +14,7 @@
14
14
 
15
15
  require_relative '../abstract/grouped_component'
16
16
  require_relative '../abstract/snapshot'
17
+ require_relative '../constants'
17
18
  require_relative '../mixins/healthy_resource_verifier'
18
19
  require_relative '../mixins/metric_verifier'
19
20
  require_relative '../mixins/snapshot_verifier'
@@ -55,7 +56,7 @@ module RubyAemAws
55
56
 
56
57
  def terminate_all_instances
57
58
  get_all_instances.each do |i|
58
- next if i.nil?
59
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
59
60
 
60
61
  i.terminate
61
62
  i.wait_until_terminated
@@ -71,7 +72,7 @@ module RubyAemAws
71
72
  def get_tags
72
73
  tags = []
73
74
  get_all_instances.each do |i|
74
- next if i.nil?
75
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
75
76
 
76
77
  tags.push(i.tags)
77
78
  end
@@ -24,6 +24,16 @@ module RubyAemAws
24
24
  ALL_ACTIVE = [PENDING, RUNNING, SHUTTING_DOWN, STOPPING, STOPPED].freeze
25
25
  end
26
26
 
27
+ # API InstanceState codes https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_InstanceState.html
28
+ class InstanceStateCode
29
+ PENDING = 0
30
+ RUNNING = 16
31
+ SHUTTING_DOWN = 32
32
+ TERMINATED = 48
33
+ STOPPING = 64
34
+ STOPPED = 80
35
+ end
36
+
27
37
  class ELBInstanceState
28
38
  INSERVICE = 'InService'.freeze
29
39
  OUTOFSERVICE = 'OutOfService'.freeze
@@ -37,6 +47,7 @@ module RubyAemAws
37
47
  SECRET_ACCESS_KEY = ENV['AWS_SECRET_ACCESS_KEY'] || ENV['aws_scret_access_key']
38
48
  PROFILE = ENV['AWS_PROFILE']
39
49
  INSTANCE_STATE_HEALTHY = RubyAemAws::InstanceState::RUNNING.freeze
50
+ INSTANCE_STATE_CODE_RUNNING = RubyAemAws::InstanceStateCode::RUNNING
40
51
  ELB_INSTANCE_INSERVICE = RubyAemAws::ELBInstanceState::INSERVICE.freeze
41
52
  end
42
53
  end
@@ -87,11 +87,14 @@ module RubyAemAws
87
87
  # puts(" Instance #{i.instance_id}: #{i.health_status}")
88
88
  # end
89
89
  # end
90
-
91
- desired_capacity = asg.desired_capacity
92
90
  instances_inservice = 0
93
- asg.instances.each do |instances|
94
- instances_inservice += 1 if instances.health_status.eql? 'Healthy'
91
+ desired_capacity = asg.desired_capacity
92
+
93
+ get_all_instances.each do |i|
94
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
95
+ return false if i.state.name != Constants::INSTANCE_STATE_HEALTHY
96
+
97
+ instances_inservice += 1
95
98
  end
96
99
 
97
100
  return :misconfigured if desired_capacity < 1
@@ -22,7 +22,7 @@ module RubyAemAws
22
22
  def healthy?
23
23
  has_instance = false
24
24
  get_all_instances.each do |i|
25
- next if i.nil? || i.state.code != 16
25
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
26
26
 
27
27
  has_instance = true
28
28
  return false if i.state.name != Constants::INSTANCE_STATE_HEALTHY
@@ -33,7 +33,7 @@ module RubyAemAws
33
33
  def wait_until_healthy
34
34
  instance_healthy = false
35
35
  get_all_instances.each do |i|
36
- next if i.nil? || i.state.code != 16
36
+ next if i.nil? || i.state.code != Constants::INSTANCE_STATE_CODE_RUNNING
37
37
 
38
38
  i.wait_until_running
39
39
  instance_healthy = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_aem_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shine Solutions
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-23 00:00:00.000000000 Z
11
+ date: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.0.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: tuples
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +72,14 @@ dependencies:
58
72
  requirements:
59
73
  - - '='
60
74
  - !ruby/object:Gem::Version
61
- version: 0.9.19
75
+ version: 0.9.20
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - '='
67
81
  - !ruby/object:Gem::Version
68
- version: 0.9.19
82
+ version: 0.9.20
69
83
  description: ruby_aem_aws is a Ruby client for Shine Solutions Adobe Experience Manager
70
84
  (AEM) Platform on AWS
71
85
  email: