cloudstrap 0.47.2.pre → 0.47.7.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloudstrap/agent.rb +7 -0
- data/lib/cloudstrap/amazon/ec2.rb +8 -2
- data/lib/cloudstrap/config.rb +10 -0
- 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: cf009d0dbf1e2326e11263d9cbd8f229f2d52d9d
|
4
|
+
data.tar.gz: '038d5a44ae753d97664336739ed46b21eff00186'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b44ee520a577dfbbc578b1da701592b4e89496b095f062296990f415f40f5a53ab9cdb2460e4b5f36337b9b84f7332507634385417bac66ea3d307dc03ec5173
|
7
|
+
data.tar.gz: 501ba92fd0c75b9e2daf5ee47fa8ca0d383ff07ce74ce367441314ea72f7ea4a499a8d976d66019d845360ddd83f6d3e4a67ef5ce5dc4280637f28cb9858614d
|
data/lib/cloudstrap/agent.rb
CHANGED
@@ -503,6 +503,13 @@ module Cloudstrap
|
|
503
503
|
@config ||= Config.new
|
504
504
|
end
|
505
505
|
|
506
|
+
Contract RespondTo[:to_s] => Maybe[Any]
|
507
|
+
def environment(variable)
|
508
|
+
ENV.fetch("#{config.environment_namespace}_#{variable.to_s.upcase}") do
|
509
|
+
yield if block_given?
|
510
|
+
end
|
511
|
+
end
|
512
|
+
|
506
513
|
Contract None => Moneta::Proxy
|
507
514
|
def cache
|
508
515
|
@cache ||= Moneta.new :File, dir: config.cache_path
|
@@ -423,8 +423,9 @@ module Cloudstrap
|
|
423
423
|
|
424
424
|
Contract None => ArrayOf[Aws::EC2::Types::AvailabilityZone]
|
425
425
|
def availability_zones!
|
426
|
-
@availability_zones =
|
427
|
-
.
|
426
|
+
@availability_zones = at_least(config.minimum_availability_zones)
|
427
|
+
.(call_api(:describe_availability_zones).availability_zones)
|
428
|
+
.take(config.maximum_availability_zones)
|
428
429
|
end
|
429
430
|
|
430
431
|
Contract None => ArrayOf[Aws::EC2::Types::AvailabilityZone]
|
@@ -439,6 +440,11 @@ module Cloudstrap
|
|
439
440
|
|
440
441
|
private
|
441
442
|
|
443
|
+
Contract Maybe[Pos] => Func[Enumerable => Enumerable]
|
444
|
+
def at_least(minimum = 0)
|
445
|
+
->(list) { list.size >= minimum ? list : list.cycle }
|
446
|
+
end
|
447
|
+
|
442
448
|
def client
|
443
449
|
Aws::EC2::Client
|
444
450
|
end
|
data/lib/cloudstrap/config.rb
CHANGED
@@ -247,6 +247,16 @@ module Cloudstrap
|
|
247
247
|
lookup(:maximum_availability_zones) { '3' }.to_i
|
248
248
|
end
|
249
249
|
|
250
|
+
Contract None => Pos
|
251
|
+
def minimum_availability_zones
|
252
|
+
lookup(:minimum_availability_zones) { '1' }.to_i
|
253
|
+
end
|
254
|
+
|
255
|
+
Contract None => String
|
256
|
+
def environment_namespace
|
257
|
+
lookup(:environment_namespace) { 'CLOUDSTRAP' }.upcase
|
258
|
+
end
|
259
|
+
|
250
260
|
private
|
251
261
|
|
252
262
|
Contract None => ::Pastel::Delegator
|