kitchen-dokken 0.0.11 → 0.0.12

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: b9baef8d8befdf9a972b01645a3142a3b7a68cd5
4
- data.tar.gz: a20d563444e920c44a06421731d3a65bfeae75cf
3
+ metadata.gz: bacb04ce73c020022800976bb73ed93889a9cddb
4
+ data.tar.gz: ccda73ee5de4c0409ebaaad8c62606db31ed52b4
5
5
  SHA512:
6
- metadata.gz: 33510911d8667c088888328688c355215225ec3a7723a35ca616ec8141606b46dd8e1ecbe520f810c9c2866b13417cb217bd1997fdb3104aa49e2fbdc32e4135
7
- data.tar.gz: 8df088b0bbeefe23c2a12fe3592fdb39203f73d712db18d7d57f9a666e954163062f87d0f1bf9ce12276b654d950888d3b615076f8471263cfffb4457c77a5e3
6
+ metadata.gz: b932eb19ed1f361724190a35dd18008dd0cfb90b77f919f626041beb28176aac7642bb09264443d11ca57d49daeb7e574899704aab626f9f48ed6b0f09e7efd8
7
+ data.tar.gz: 5a7bb932b1d29e098f89ed805ebbbdae46bbd31d6551631694eb228b329b38c458931daa1465f4614d47b0385e0aca3552c3e02309c089b11254a6bdffc778e9
@@ -48,7 +48,7 @@ module Kitchen
48
48
 
49
49
  # chef
50
50
  pull_chef_image
51
- start_chef_container state
51
+ create_chef_container state
52
52
 
53
53
  # data
54
54
  make_data_image
@@ -177,6 +177,7 @@ module Kitchen
177
177
  },
178
178
  'PublishAllPorts' => true
179
179
  )
180
+ # require 'pry' ; binding.pry
180
181
  state[:data_container] = data_container.json
181
182
  end
182
183
 
@@ -188,7 +189,7 @@ module Kitchen
188
189
  # create_data_image
189
190
  end
190
191
 
191
- def start_chef_container(state)
192
+ def create_chef_container(state)
192
193
  c = Docker::Container.get(chef_container_name)
193
194
  rescue Docker::Error::NotFoundError
194
195
  begin
@@ -215,14 +216,14 @@ module Kitchen
215
216
  end
216
217
 
217
218
  def delete_image(name)
218
- @image = Docker::Image.get(name, docker_connection)
219
+ with_retries { @image = Docker::Image.get(name, docker_connection) }
219
220
  with_retries { @image.remove(force: true) }
220
221
  rescue Docker::Error => e
221
222
  puts "Image #{name} not found. Nothing to delete."
222
223
  end
223
224
 
224
225
  def delete_container(name)
225
- @container = Docker::Container.get(name, docker_connection)
226
+ with_retries { @container = Docker::Container.get(name, docker_connection) }
226
227
  puts "Destroying container #{name}."
227
228
  with_retries { @container.stop(force: true) }
228
229
  with_retries { @container.delete(force: true, v: true) }
@@ -236,19 +237,44 @@ module Kitchen
236
237
  false
237
238
  end
238
239
 
240
+ def repo(image)
241
+ image.split(':')[0]
242
+ end
243
+
239
244
  def create_container(args)
240
- c = Docker::Container.create(args.clone, docker_connection)
245
+ with_retries do
246
+ @container = Docker::Container.create(args.clone, docker_connection)
247
+ @container = Docker::Container.get(args['name'])
248
+ end
241
249
  rescue Docker::Error::ConflictError
242
- c = Docker::Container.get(args['name'])
250
+ with_retries { @container = Docker::Container.get(args['name']) }
243
251
  end
244
252
 
245
- def repo(image)
246
- image.split(':')[0]
253
+ def run_container(args)
254
+ create_container(args)
255
+ with_retries do
256
+ @container.start
257
+ @container = Docker::Container.get(args['name'])
258
+ wait_running_state(args['name'], true)
259
+ end
260
+ @container
247
261
  end
248
262
 
249
- def run_container(args)
250
- @container = create_container(args)
251
- with_retries { @container.start }
263
+ def container_state
264
+ @container ? @container.info['State'] : {}
265
+ end
266
+
267
+ def wait_running_state(name, v)
268
+ @container = Docker::Container.get(name)
269
+ # require 'pry' ; binding.pry
270
+ i = 0
271
+ tries = 20
272
+ until container_state['Running'] == v || container_state['FinishedAt'] != '0001-01-01T00:00:00Z'
273
+ i += 1
274
+ break if i == tries
275
+ sleep 0.1
276
+ @container = Docker::Container.get(name)
277
+ end
252
278
  end
253
279
 
254
280
  def tag(image)
@@ -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.11'
22
+ DOKKEN_VERSION = '0.0.12'
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.11
4
+ version: 0.0.12
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-22 00:00:00.000000000 Z
11
+ date: 2015-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen