docker_toolkit 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d935e4bd836ceca9cb0917d1faec74ffd91119169e9a3df7d5d361fd0b7fec0
4
- data.tar.gz: 987ae5d719e8f65c7e66a80fbf2ab98879187964a8de0de0733463460dbed6d3
3
+ metadata.gz: 8c4b61f2f778550a54b6624e8cf0ca452dbbcdc9ef5898d1f1d1ff613f3d35b0
4
+ data.tar.gz: c88fcd9cca74e20499d497a98f1642c4d70675d7bad603ae46d847f236784ec5
5
5
  SHA512:
6
- metadata.gz: 86d0413625caf52c980135b33189fcfaa37e191e0d5e930a332b3c5e4874ed77b8ea5d3e271136a38bdc97b3a3c2930e702574d70cd8acd4748373dd5bd834b4
7
- data.tar.gz: 9e53104e56f7fada1adc7aa7b5015f3cab50119c688da2ca59a5048652b595af7f379f9525a3c569526809f36921fbf8159e811eca6d0db6a793e56a85b17137
6
+ metadata.gz: cbba6fd41edf1c4b9139cd2d41ce0da4576dc4dda28f04352d18c39797426751af59f6a4bcce8498df0bbacc87703f6e1b95c6634fd43d77505268762945790c
7
+ data.tar.gz: cbe40ccf9cf5c8a05602db56f47291bd65030ad8f3592723415c5ce1caca2f03691579fb47c2268b0aeefed0eb0ad67b2472ee568cf652d8322fe476b006cb1a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- docker_toolkit (0.1.16)
4
+ docker_toolkit (0.1.17)
5
5
  diplomat
6
6
  dotenv
7
7
  json
data/README.md CHANGED
@@ -27,6 +27,7 @@ Usage: waiter.rb [options] -- exec
27
27
  HTTP addres to connect to consul
28
28
  --consul Wait for local consul agent to be ready
29
29
  --consul-service service Wait for service appear in consul
30
+ --consul-service-count count Wait for this count services appear in consul
30
31
  --user user username
31
32
  --pass pass password
32
33
  -t, --timeout secs=15 Total timeout
data/bin/waiter.rb CHANGED
@@ -22,6 +22,7 @@ INTERVAL = 3
22
22
  @opts[:timeout] = TIMEOUT
23
23
  @opts[:interval] = INTERVAL
24
24
  @opts[:consul_addr] = 'http://localhost:8500'
25
+ @opts[:consul_service_count] = 1
25
26
 
26
27
 
27
28
  OptionParser.new do |o|
@@ -58,6 +59,10 @@ OptionParser.new do |o|
58
59
  @opts[:consul_service] = service
59
60
  end
60
61
 
62
+ o.on("--consul-service-count count=#{@opts[:consul_service_count]}", 'Wait for this count of service appear in consul') do |count|
63
+ @opts[:consul_service_count] = count.to_i
64
+ end
65
+
61
66
  o.on('--user user', 'username') do |user|
62
67
  @opts[:user] = user.strip
63
68
  end
@@ -143,9 +148,9 @@ end
143
148
  def wait_for_consul_service(service)
144
149
  log("Waiting for consul service #{service}...")
145
150
  ret = wait_for @opts[:timeout] do
146
- cmd = "curl -s #{@opts[:consul_addr]}/v1/health/service/#{service}?passing | wc -c"
147
- bytes = `#{cmd}`.to_i
148
- bytes > 10
151
+ cmd = "curl -s #{@opts[:consul_addr]}/v1/health/service/#{service}?passing"
152
+ result = JSON.parse(`#{cmd}`) rescue []
153
+ result.count >= @opts[:consul_service_count]
149
154
  end
150
155
 
151
156
  yield(ret)
@@ -1,5 +1,5 @@
1
1
  module DockerToolkit
2
2
 
3
- VERSION = '0.1.16'.freeze
3
+ VERSION = '0.1.17'.freeze
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Godko Ivan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-20 00:00:00.000000000 Z
12
+ date: 2018-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diplomat