aerosol 1.9.1 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/lib/aerosol/auto_scaling.rb +7 -8
- data/lib/aerosol/aws_model.rb +6 -4
- data/lib/aerosol/instance.rb +5 -7
- data/lib/aerosol/launch_template.rb +6 -12
- data/lib/aerosol/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d4984e8f3a4ad49c8fcf43ee3f8a46afc0a8ff5a03bc17e0e2a7c5ae51d5ff9
|
4
|
+
data.tar.gz: 6a02a6faf80b6a0bc3ccb317df748dac95d994f4a0fb146724ed844240727451
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddb94dbd6f44e8cb419d6051fc0e5855a8bc5bb9ce45de11e35da6600831d0a8f8928990d0429aa6f415b80a91381c4c198a5c1d8a2a341f7ea47992b2417178
|
7
|
+
data.tar.gz: 5f2488d1ec6336cb2a4a3aea9dadd7ab030b788bfb72fffb8723369857e875ccba832d88ecba070098c750d208de76c74ac5ee9c80cb4879f497e9f829435e0a
|
data/.travis.yml
CHANGED
data/lib/aerosol/auto_scaling.rb
CHANGED
@@ -7,7 +7,12 @@ class Aerosol::AutoScaling
|
|
7
7
|
:desired_capacity, :health_check_grace_period, :health_check_type, :load_balancer_names,
|
8
8
|
:placement_group, :tags, :created_time, :vpc_zone_identifier, :target_group_arns
|
9
9
|
aws_class_attribute :launch_configuration, Aerosol::LaunchConfiguration
|
10
|
-
aws_class_attribute
|
10
|
+
aws_class_attribute(
|
11
|
+
:launch_template,
|
12
|
+
Aerosol::LaunchTemplate,
|
13
|
+
proc { |argument| argument.fetch(:launch_template, {})[:launch_template_name] }
|
14
|
+
)
|
15
|
+
|
11
16
|
primary_key :auto_scaling_group_name
|
12
17
|
|
13
18
|
def initialize(options={}, &block)
|
@@ -88,7 +93,7 @@ class Aerosol::AutoScaling
|
|
88
93
|
def all_instances
|
89
94
|
conn.describe_auto_scaling_groups(auto_scaling_group_names: [*auto_scaling_group_name])
|
90
95
|
.auto_scaling_groups.first
|
91
|
-
.instances.map { |instance| Aerosol::Instance.from_hash(instance) }
|
96
|
+
.instances.map { |instance| Aerosol::Instance.from_hash(instance.to_hash) }
|
92
97
|
end
|
93
98
|
|
94
99
|
def launch_details
|
@@ -156,12 +161,6 @@ class Aerosol::AutoScaling
|
|
156
161
|
}}
|
157
162
|
end
|
158
163
|
|
159
|
-
def self.from_hash(hash)
|
160
|
-
instance = super(hash)
|
161
|
-
instance['launch_template'] = (hash[:launch_template][:launch_template_name]) if hash[:launch_template]
|
162
|
-
instance
|
163
|
-
end
|
164
|
-
|
165
164
|
private
|
166
165
|
def conn
|
167
166
|
Aerosol::AWS.auto_scaling
|
data/lib/aerosol/aws_model.rb
CHANGED
@@ -47,13 +47,15 @@ module Aerosol::AWSModel
|
|
47
47
|
aws_attributes.merge(attrs)
|
48
48
|
end
|
49
49
|
|
50
|
-
def aws_class_attribute(name, klass)
|
50
|
+
def aws_class_attribute(name, klass, primary_key_proc = nil)
|
51
51
|
unless klass.ancestors.include?(Aerosol::AWSModel) || (klass == self)
|
52
52
|
raise '.aws_class_attribute requires a Aerosol::AWSModel that is not the current class.'
|
53
53
|
end
|
54
54
|
|
55
|
+
primary_key_proc ||= proc { |hash| hash[klass.primary_key] }
|
56
|
+
|
55
57
|
dsl_class_attribute(name, klass)
|
56
|
-
aws_class_attributes.merge!({ name => klass })
|
58
|
+
aws_class_attributes.merge!({ name => [klass, primary_key_proc] })
|
57
59
|
end
|
58
60
|
|
59
61
|
def exists?(key)
|
@@ -67,9 +69,9 @@ module Aerosol::AWSModel
|
|
67
69
|
|
68
70
|
def from_hash(hash)
|
69
71
|
raise 'To use .from_hash, you must specify a primary_key' if primary_key.nil?
|
70
|
-
refs = Hash[aws_class_attributes.map do |name, klass|
|
72
|
+
refs = Hash[aws_class_attributes.map do |name, (klass, primary_key_proc)|
|
71
73
|
value = klass.instances.values.find do |inst|
|
72
|
-
inst.send(klass.primary_key).to_s == hash
|
74
|
+
inst.send(klass.primary_key).to_s == primary_key_proc.call(hash).to_s unless inst.send(klass.primary_key).nil?
|
73
75
|
end
|
74
76
|
[name, value]
|
75
77
|
end].reject { |k, v| v.nil? }
|
data/lib/aerosol/instance.rb
CHANGED
@@ -5,7 +5,11 @@ class Aerosol::Instance
|
|
5
5
|
|
6
6
|
aws_attribute :availability_zone, :health_status, :instance_id, :lifecycle_state
|
7
7
|
aws_class_attribute :launch_configuration, Aerosol::LaunchConfiguration
|
8
|
-
aws_class_attribute
|
8
|
+
aws_class_attribute(
|
9
|
+
:launch_template,
|
10
|
+
Aerosol::LaunchTemplate,
|
11
|
+
proc { |argument| argument.fetch(:launch_template, {})[:launch_template_name] }
|
12
|
+
)
|
9
13
|
primary_key :instance_id
|
10
14
|
|
11
15
|
def live?
|
@@ -59,12 +63,6 @@ class Aerosol::Instance
|
|
59
63
|
instances
|
60
64
|
end
|
61
65
|
|
62
|
-
def self.from_hash(hash)
|
63
|
-
instance = super(hash)
|
64
|
-
instance['launch_template'] = (hash[:launch_template][:launch_template_name]) if hash[:launch_template]
|
65
|
-
instance
|
66
|
-
end
|
67
|
-
|
68
66
|
private
|
69
67
|
def describe!
|
70
68
|
ensure_present! :instance_id
|
@@ -3,7 +3,8 @@ class Aerosol::LaunchTemplate
|
|
3
3
|
include Dockly::Util::Logger::Mixin
|
4
4
|
|
5
5
|
logger_prefix '[aerosol launch_template]'
|
6
|
-
aws_attribute :launch_template_name, :
|
6
|
+
aws_attribute :launch_template_name, :launch_template_id, :latest_version_number,
|
7
|
+
:image_id, :instance_type, :security_groups, :user_data,
|
7
8
|
:iam_instance_profile, :kernel_id, :key_name, :spot_price, :created_time,
|
8
9
|
:network_interfaces, :block_device_mappings, :ebs_optimized
|
9
10
|
dsl_attribute :meta_data
|
@@ -21,15 +22,6 @@ class Aerosol::LaunchTemplate
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
def exists?
|
25
|
-
info "launch_template: needed?: #{launch_template_name}: " +
|
26
|
-
"checking for launch template: #{launch_template_name}"
|
27
|
-
exists = super
|
28
|
-
info "launch template: needed?: #{launch_template_name}: " +
|
29
|
-
"#{exists ? 'found' : 'did not find'} launch template: #{launch_template_name}"
|
30
|
-
exists
|
31
|
-
end
|
32
|
-
|
33
25
|
def security_group(group)
|
34
26
|
security_groups << group
|
35
27
|
end
|
@@ -48,6 +40,7 @@ class Aerosol::LaunchTemplate
|
|
48
40
|
},
|
49
41
|
}.merge(create_options)
|
50
42
|
)
|
43
|
+
|
51
44
|
info self.inspect
|
52
45
|
end
|
53
46
|
|
@@ -60,7 +53,7 @@ class Aerosol::LaunchTemplate
|
|
60
53
|
def all_instances
|
61
54
|
Aerosol::Instance.all.select { |instance|
|
62
55
|
!instance.launch_template.nil? &&
|
63
|
-
(instance.launch_template == launch_template_name)
|
56
|
+
(instance.launch_template.launch_template_name == launch_template_name)
|
64
57
|
}.each(&:description)
|
65
58
|
end
|
66
59
|
|
@@ -78,13 +71,14 @@ class Aerosol::LaunchTemplate
|
|
78
71
|
lts.concat(new_lts.launch_templates)
|
79
72
|
next_token = new_lts.next_token
|
80
73
|
end until next_token.nil?
|
81
|
-
|
82
74
|
lts
|
83
75
|
end
|
84
76
|
|
85
77
|
def to_s
|
86
78
|
%{Aerosol::LaunchTemplate { \
|
87
79
|
"launch_template_name" => "#{launch_template_name}", \
|
80
|
+
"launch_template_id" => "#{launch_template_id}", \
|
81
|
+
"latest_version_number" => "#{latest_version_number}", \
|
88
82
|
"image_id" => "#{image_id}", \
|
89
83
|
"instance_type" => "#{instance_type}", \
|
90
84
|
"security_group_ids" => #{security_groups.to_s}, \
|
data/lib/aerosol/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aerosol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swipely, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|