sortinghat 0.2.0 → 0.3.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 +4 -4
- data/lib/sortinghat/banquet.rb +11 -6
- data/lib/sortinghat/version.rb +1 -1
- data/sortinghat.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9889a8fb4851b45b061c057c8fd958c42c2c5cd
|
4
|
+
data.tar.gz: 124f2e6179e1eda555a010f35b221ce9782cdf60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74410f415bc0043c707bd07e72ee96e69e838ecb309cd0b2fa2975f6f8d65aab5528460e8754a36e3c9aacd6c51375c258ba433d91cd76f101369c6e8f25424d
|
7
|
+
data.tar.gz: 127e62bd80ff09c4640ad3d92c6f12656622bdc4f49076fffb86339e3791f1edc1469d6eb25879a091711ac795977d0e61186061fa714385c26873f8c4122006
|
data/lib/sortinghat/banquet.rb
CHANGED
@@ -36,9 +36,13 @@ module Sortinghat
|
|
36
36
|
|
37
37
|
# Main method of Sortinghat
|
38
38
|
def start!
|
39
|
+
|
40
|
+
# Best thing to avoid run conditions are to wait
|
41
|
+
sleep rand(5)
|
42
|
+
|
39
43
|
# Find out who is who, instances alive
|
40
|
-
# If discover() returns
|
41
|
-
alive = cleanup(@aws.discover())
|
44
|
+
# If discover() returns an Array full of nil(s), alive will be nil
|
45
|
+
alive = cleanup!(@aws.discover())
|
42
46
|
|
43
47
|
# Given the alive instances, find our prefix
|
44
48
|
# If alive is nil, selection will return the number '1'
|
@@ -50,8 +54,8 @@ module Sortinghat
|
|
50
54
|
@aws.settag!(@hostname)
|
51
55
|
|
52
56
|
# Find out who is who, instances alive
|
53
|
-
# If discover() returns
|
54
|
-
alive = cleanup(@aws.discover())
|
57
|
+
# If discover() returns an Array full of nil(s), alive will be nil
|
58
|
+
alive = cleanup!(@aws.discover())
|
55
59
|
|
56
60
|
unless alive.uniq.length == alive.length
|
57
61
|
# There are duplicates, remove tag, wait, restart
|
@@ -92,8 +96,9 @@ module Sortinghat
|
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
95
|
-
def cleanup(array)
|
96
|
-
|
99
|
+
def cleanup!(array)
|
100
|
+
array.reject! { |item| item.nil? }
|
101
|
+
return [] if array.empty?
|
97
102
|
array.select! { |name| name.include?(@options[:env]) and name.include?(@options[:client]) and name.include?(@options[:type]) }
|
98
103
|
end
|
99
104
|
|
data/lib/sortinghat/version.rb
CHANGED
data/sortinghat.gemspec
CHANGED
@@ -31,6 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
32
|
spec.add_development_dependency "rspec"
|
33
33
|
|
34
|
-
spec.add_runtime_dependency "aws-sdk", '
|
34
|
+
spec.add_runtime_dependency "aws-sdk", '2.1.2'
|
35
35
|
spec.add_runtime_dependency "json_pure"
|
36
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sortinghat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- D. Pramann
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: aws-sdk
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.1.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.1.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json_pure
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|