stackit 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stackit.rb +2 -0
- data/lib/stackit/mixin/availability_zone.rb +34 -1
- data/lib/stackit/mixin/tier.rb +39 -0
- data/lib/stackit/stack/managed_stack.rb +3 -0
- data/lib/stackit/stack/managed_stack_service.rb +4 -2
- data/lib/stackit/stack/opsworks_managed_stack_service.rb +9 -0
- data/lib/stackit/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b39c2acbc470ade26621ca98efb4022dc6a6fee1
|
4
|
+
data.tar.gz: 399b7ae0ffe05e4eb97cc515ca8163ebf0f5efdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bae425a405e846166d0a9e83b83f1ba9bf4dbe1b937943f0ddb463dab8f91bcb14eabe272910f14fb0477d8a023d605f39cfa5c6302f06ded70edfa9a9f9c8d4
|
7
|
+
data.tar.gz: ebecc281df32b6392c39f1b217722fa27901a83c156acadc9d96c2503a0d5734c95f6194d5873f5d69fd3bfe82c42843a5eb4c4fc6eda751354a8909120bfdf2
|
data/lib/stackit.rb
CHANGED
@@ -1,7 +1,40 @@
|
|
1
1
|
module Stackit::Mixin::AvailabilityZone
|
2
2
|
|
3
|
-
def
|
3
|
+
def selected_az_sym
|
4
|
+
selected_az.keys[0].to_sym
|
5
|
+
end
|
6
|
+
|
7
|
+
def selected_az_value
|
8
|
+
selected_az.values[0]
|
9
|
+
end
|
10
|
+
|
11
|
+
def subnet_id_for_selected_az(tier, az_sym = selected_az_sym)
|
12
|
+
az_subnet_mapping = az_subnet_map(tier)
|
13
|
+
selected_subnet_key = az_subnet_mapping[az_sym]
|
14
|
+
resolve_parameter(selected_subnet_key)
|
15
|
+
end
|
16
|
+
|
17
|
+
def random_az(keys = default_az_keys)
|
4
18
|
resolve_parameters(keys).split(',').sample
|
5
19
|
end
|
6
20
|
|
21
|
+
def random_az_as_hash(keys = default_az_keys)
|
22
|
+
sampled_az_key = default_az_keys.sample
|
23
|
+
sampled_az_value = resolve_parameter(sampled_az_key.to_sym)
|
24
|
+
{
|
25
|
+
sampled_az_key => sampled_az_value
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def default_az_keys
|
32
|
+
[:VpcAvailabilityZone1, :VpcAvailabilityZone2, :VpcAvailabilityZone3]
|
33
|
+
end
|
34
|
+
|
35
|
+
def selected_az
|
36
|
+
@selected_az ||= random_az_as_hash
|
37
|
+
end
|
38
|
+
|
7
39
|
end
|
40
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative 'availability_zone'
|
2
|
+
|
3
|
+
module Stackit::Mixin::Tier
|
4
|
+
|
5
|
+
include Stackit::Mixin::AvailabilityZone
|
6
|
+
|
7
|
+
attr_accessor :tier
|
8
|
+
|
9
|
+
def tier=(tier)
|
10
|
+
@tier = tier.to_sym
|
11
|
+
end
|
12
|
+
|
13
|
+
def random_tier_az
|
14
|
+
random_az ||= random_az_as_hash
|
15
|
+
end
|
16
|
+
|
17
|
+
def random_tier_az_sym
|
18
|
+
random_tier_az.keys[0].to_sym
|
19
|
+
end
|
20
|
+
|
21
|
+
def random_tier_az_value
|
22
|
+
random_tier_az.values[0]
|
23
|
+
end
|
24
|
+
|
25
|
+
def random_az_and_subnet
|
26
|
+
random_az = random_az_as_hash
|
27
|
+
random_az_sym = random_az.keys[0].to_sym
|
28
|
+
random_az_value = random_az.values[0]
|
29
|
+
az_subnet_mapping = az_subnet_map(tier)
|
30
|
+
selected_subnet_key = az_subnet_mapping[random_az_sym]
|
31
|
+
resolved_subnet = resolve_parameter(selected_subnet_key)
|
32
|
+
{
|
33
|
+
:az => random_az_value,
|
34
|
+
:subnet => resolved_subnet
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
@@ -271,6 +271,9 @@ module Stackit
|
|
271
271
|
merged_params.merge!(param_name => this_stack[mapped_key(param_name)])
|
272
272
|
end
|
273
273
|
end
|
274
|
+
user_defined_parameters.each { |k, v|
|
275
|
+
user_defined_parameters[k] = v.to_s
|
276
|
+
}
|
274
277
|
merged_params.merge!(user_defined_parameters)
|
275
278
|
end
|
276
279
|
|
@@ -139,6 +139,7 @@ module Stackit
|
|
139
139
|
options[:depends].each do |stack|
|
140
140
|
@depends_stacks << Stackit::Stack.new(stack_name: stack)
|
141
141
|
end
|
142
|
+
@depends_stacks
|
142
143
|
end
|
143
144
|
|
144
145
|
def stacks
|
@@ -146,10 +147,11 @@ module Stackit
|
|
146
147
|
end
|
147
148
|
|
148
149
|
def resolve_parameter(key)
|
149
|
-
depends_stacks.each do |
|
150
|
-
value =
|
150
|
+
depends_stacks.each do |_stack|
|
151
|
+
value = _stack[key.to_s]
|
151
152
|
return value unless value.nil?
|
152
153
|
end
|
154
|
+
nil
|
153
155
|
end
|
154
156
|
|
155
157
|
def resolve_parameters(keys)
|
data/lib/stackit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Hahn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -147,11 +147,13 @@ files:
|
|
147
147
|
- lib/stackit/cli/stackit_cli.rb
|
148
148
|
- lib/stackit/mixin/availability_zone.rb
|
149
149
|
- lib/stackit/mixin/opsworks.rb
|
150
|
+
- lib/stackit/mixin/tier.rb
|
150
151
|
- lib/stackit/stack.rb
|
151
152
|
- lib/stackit/stack/default-stack-policy.json
|
152
153
|
- lib/stackit/stack/default_notifier.rb
|
153
154
|
- lib/stackit/stack/managed_stack.rb
|
154
155
|
- lib/stackit/stack/managed_stack_service.rb
|
156
|
+
- lib/stackit/stack/opsworks_managed_stack_service.rb
|
155
157
|
- lib/stackit/template.rb
|
156
158
|
- lib/stackit/version.rb
|
157
159
|
- lib/stackit/wait.rb
|