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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 59892d22cedf8e98be4abe64b1eaad223777806a
4
- data.tar.gz: c66c95ed0098a384a0e5797e6a914354e7431c0c
3
+ metadata.gz: f9889a8fb4851b45b061c057c8fd958c42c2c5cd
4
+ data.tar.gz: 124f2e6179e1eda555a010f35b221ce9782cdf60
5
5
  SHA512:
6
- metadata.gz: 0bef5473f37c0d14c36ab6290340c9d1764ac70c72b3c39bbcea12455da3ae871a88ad5288aa700cec18eddf96c961b93b1d2989090362d0d8bc2017ba3d2e2d
7
- data.tar.gz: 8ae5477f8b4b6fdec97b50193147601353f546fbf2543c44bed0cc0c326bc63cd3504a56e6f742e9f1d4d1cd4484b2d3408f9ec3ab505858dff589a92e570ca4
6
+ metadata.gz: 74410f415bc0043c707bd07e72ee96e69e838ecb309cd0b2fa2975f6f8d65aab5528460e8754a36e3c9aacd6c51375c258ba433d91cd76f101369c6e8f25424d
7
+ data.tar.gz: 127e62bd80ff09c4640ad3d92c6f12656622bdc4f49076fffb86339e3791f1edc1469d6eb25879a091711ac795977d0e61186061fa714385c26873f8c4122006
@@ -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 a nil Array, alive will be nil
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 a nil Array, alive will be nil
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
- return [] if array.any? { |item| item.nil? }
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
 
@@ -1,3 +1,3 @@
1
1
  module Sortinghat
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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", '~> 2'
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.2.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: '2'
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: '2'
68
+ version: 2.1.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: json_pure
71
71
  requirement: !ruby/object:Gem::Requirement