kitchen-dokken 0.0.10 → 0.0.11

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
  SHA1:
3
- metadata.gz: e41ed07a9b6101a9c1776cfefd7331da307e7b05
4
- data.tar.gz: c59293c765538e6305d250d327b2d7052190d797
3
+ metadata.gz: b9baef8d8befdf9a972b01645a3142a3b7a68cd5
4
+ data.tar.gz: a20d563444e920c44a06421731d3a65bfeae75cf
5
5
  SHA512:
6
- metadata.gz: cd9c118f1dffbf87599cebf010625de01827689bb2112b3d2a77dc54e8a29023b1b96b93b1b9e5832299366da32def5aa7df91259979a648b176a36cda1726ea
7
- data.tar.gz: 6ed4b419f23f8da2ead923c35969c5d02f03c54422743415d9a1cef301a283bdf89994795d52accf8954ce1cea3c6522e736b52bf8877dfb782942327dbbfddd
6
+ metadata.gz: 33510911d8667c088888328688c355215225ec3a7723a35ca616ec8141606b46dd8e1ecbe520f810c9c2866b13417cb217bd1997fdb3104aa49e2fbdc32e4135
7
+ data.tar.gz: 8df088b0bbeefe23c2a12fe3592fdb39203f73d712db18d7d57f9a666e954163062f87d0f1bf9ce12276b654d950888d3b615076f8471263cfffb4457c77a5e3
@@ -39,6 +39,7 @@ module Kitchen
39
39
  default_config :docker_host_url, ENV['DOCKER_HOST'] || 'unix:///var/run/docker.sock'
40
40
  default_config :read_timeout, 3600
41
41
  default_config :write_timeout, 3600
42
+ default_config :api_retries, 20
42
43
 
43
44
  # (see Base#create)
44
45
  def create(state)
@@ -63,6 +64,10 @@ module Kitchen
63
64
  save_misc_state state
64
65
  end
65
66
 
67
+ def api_retries
68
+ config[:api_retries]
69
+ end
70
+
66
71
  def destroy(_state)
67
72
  delete_data
68
73
  delete_runner
@@ -81,7 +86,7 @@ module Kitchen
81
86
  def delete_work_image
82
87
  return unless Docker::Image.exist?(work_image, docker_connection)
83
88
  with_retries { @work_image = Docker::Image.get(work_image, docker_connection) }
84
- with_retries { @work_image.remove(force: true)}
89
+ with_retries { @work_image.remove(force: true) }
85
90
  end
86
91
 
87
92
  def build_work_image(state)
@@ -210,22 +215,17 @@ module Kitchen
210
215
  end
211
216
 
212
217
  def delete_image(name)
213
- i = Docker::Image.get(name, docker_connection)
214
- with_retries { i.remove(force: true) }
218
+ @image = Docker::Image.get(name, docker_connection)
219
+ with_retries { @image.remove(force: true) }
215
220
  rescue Docker::Error => e
216
221
  puts "Image #{name} not found. Nothing to delete."
217
222
  end
218
223
 
219
- def run_container(args)
220
- c = create_container(args)
221
- with_retries { c.start }
222
- end
223
-
224
224
  def delete_container(name)
225
- c = Docker::Container.get(name, docker_connection)
225
+ @container = Docker::Container.get(name, docker_connection)
226
226
  puts "Destroying container #{name}."
227
- with_retries { c.stop(force: true) }
228
- with_retries { c.delete(force: true, v: true) }
227
+ with_retries { @container.stop(force: true) }
228
+ with_retries { @container.delete(force: true, v: true) }
229
229
  rescue
230
230
  puts "Container #{name} not found. Nothing to delete."
231
231
  end
@@ -246,6 +246,11 @@ module Kitchen
246
246
  image.split(':')[0]
247
247
  end
248
248
 
249
+ def run_container(args)
250
+ @container = create_container(args)
251
+ with_retries { @container.start }
252
+ end
253
+
249
254
  def tag(image)
250
255
  image.split(':')[1] || 'latest'
251
256
  end
@@ -288,7 +293,7 @@ module Kitchen
288
293
  end
289
294
 
290
295
  def with_retries(&block)
291
- tries = 5
296
+ tries = api_retries
292
297
  begin
293
298
  block.call
294
299
  # Only catch errors that can be fixed with retries.
@@ -19,6 +19,6 @@
19
19
  module Kitchen
20
20
  module Driver
21
21
  # Version string for Dokken Kitchen driver
22
- DOKKEN_VERSION = '0.0.10'
22
+ DOKKEN_VERSION = '0.0.11'
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-dokken
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean OMeara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-21 00:00:00.000000000 Z
11
+ date: 2015-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen