stackit 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stackit/mixin/availability_zone.rb +17 -20
- data/lib/stackit/mixin/tier.rb +25 -11
- data/lib/stackit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de939371b4c2853953a61ce1851f1ac00e2bad9a
|
4
|
+
data.tar.gz: 3b5b469c61b4a782c48c026b59b00f15b9bc315d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e41b598ae066cec28c01cf73671c8e624c633aae1c835f53035bf3934eef2c7b826371c149d6f8f1c1362005fe849a8be0f980e11f82b87dcc4b77523a2ab8d
|
7
|
+
data.tar.gz: 0b428e5bfb1a5b863bc2344624d9fd67b4ff3896bbe4abaa907bc7ddc61173dc49d375a09732fc4caa1aa920920482eae5122820866f01fadbd1116e451708b1
|
@@ -1,39 +1,36 @@
|
|
1
1
|
module Stackit::Mixin::AvailabilityZone
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
attr_accessor :az_syms
|
4
|
+
|
5
|
+
def az_syms=(keys)
|
6
|
+
@az_syms = keys.each{ |key|
|
7
|
+
key = key.to_sym
|
8
|
+
}
|
5
9
|
end
|
6
10
|
|
7
|
-
def
|
8
|
-
|
11
|
+
def selected_az_sym
|
12
|
+
selected_az_hash.keys[0].to_sym
|
9
13
|
end
|
10
14
|
|
11
|
-
def
|
12
|
-
|
13
|
-
selected_subnet_key = az_subnet_mapping[az_sym]
|
14
|
-
resolve_parameter(selected_subnet_key)
|
15
|
+
def selected_az
|
16
|
+
selected_az_hash.values[0]
|
15
17
|
end
|
16
18
|
|
17
|
-
def random_az
|
18
|
-
resolve_parameters(
|
19
|
+
def random_az
|
20
|
+
resolve_parameters(az_syms).split(',').sample
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
22
|
-
|
23
|
-
sampled_az_value = resolve_parameter(sampled_az_key.to_sym)
|
23
|
+
def random_az_hash
|
24
|
+
sampled_az_sym = az_syms.sample
|
24
25
|
{
|
25
|
-
|
26
|
+
sampled_az_sym => resolve_parameter(sampled_az_sym)
|
26
27
|
}
|
27
28
|
end
|
28
29
|
|
29
30
|
private
|
30
31
|
|
31
|
-
def
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
def selected_az
|
36
|
-
@selected_az ||= random_az_as_hash
|
32
|
+
def selected_az_hash
|
33
|
+
@selected_az_hash ||= random_az_hash
|
37
34
|
end
|
38
35
|
|
39
36
|
end
|
data/lib/stackit/mixin/tier.rb
CHANGED
@@ -5,30 +5,44 @@ module Stackit::Mixin::Tier
|
|
5
5
|
include Stackit::Mixin::AvailabilityZone
|
6
6
|
|
7
7
|
attr_accessor :tier
|
8
|
+
attr_accessor :tier_map
|
8
9
|
|
9
10
|
def tier=(tier)
|
10
11
|
@tier = tier.to_sym
|
11
12
|
end
|
12
13
|
|
13
|
-
def
|
14
|
-
|
14
|
+
def tier_map=(map)
|
15
|
+
@tier_map = map
|
15
16
|
end
|
16
17
|
|
17
|
-
def
|
18
|
-
|
18
|
+
def selected_subnet_sym
|
19
|
+
tier_map[tier][selected_az_sym]
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
|
22
|
+
def selected_subnet
|
23
|
+
resolve_parameter(selected_subnet_sym)
|
24
|
+
end
|
25
|
+
|
26
|
+
def subnets
|
27
|
+
resolve_parameters(tier_map[tier].values)
|
28
|
+
end
|
29
|
+
|
30
|
+
def random_subnet
|
31
|
+
random_az_and_subnet[:subnet]
|
32
|
+
end
|
33
|
+
|
34
|
+
def random_subnet_sym
|
35
|
+
random_az = random_az_hash
|
36
|
+
random_az_sym = random_az.keys[0]
|
37
|
+
tier_map[tier][random_az_sym]
|
23
38
|
end
|
24
39
|
|
25
40
|
def random_az_and_subnet
|
26
|
-
random_az =
|
27
|
-
random_az_sym = random_az.keys[0]
|
41
|
+
random_az = random_az_hash
|
42
|
+
random_az_sym = random_az.keys[0]
|
28
43
|
random_az_value = random_az.values[0]
|
29
|
-
|
30
|
-
|
31
|
-
resolved_subnet = resolve_parameter(selected_subnet_key)
|
44
|
+
selected_subnet_sym = tier_map[tier][random_az_sym]
|
45
|
+
resolved_subnet = resolve_parameter(selected_subnet_sym)
|
32
46
|
{
|
33
47
|
:az => random_az_value,
|
34
48
|
:subnet => resolved_subnet
|
data/lib/stackit/version.rb
CHANGED