kitchen-dokken 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen/driver/dokken.rb +54 -20
- data/lib/kitchen/driver/dokken_version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12ee1dc19f8d22d9f5aa9f88f392f3dd8ea55b66
|
4
|
+
data.tar.gz: 72a617ee991bf7fc87a566c1d787e616d88e2f75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa34003deca0e959a5d5eae5bf2088e6543a9136b7e98b2b3a5997c6917aeae6b08ed3070004cfeaf214ef85afbf81d2b24c694c3bc1db98a06dd96cd3f705db
|
7
|
+
data.tar.gz: 7df22675aff22cba3a9c15ce2d5c1cb1bc47a0889b52298ba35176aad0e685e3d4b74d568495f3a826882004c01dd3a065e9a775f09b212f024ccd0c258e13ce
|
@@ -32,27 +32,27 @@ module Kitchen
|
|
32
32
|
#
|
33
33
|
# @author Sean OMeara <sean@chef.io>
|
34
34
|
class Dokken < Kitchen::Driver::Base
|
35
|
-
default_config :
|
36
|
-
default_config :
|
35
|
+
default_config :api_retries, 20
|
36
|
+
default_config :binds, []
|
37
|
+
default_config :cap_add, nil
|
38
|
+
default_config :cap_drop, nil
|
37
39
|
default_config :chef_image, 'chef/chef'
|
38
40
|
default_config :chef_version, 'current'
|
39
41
|
default_config :data_image, 'dokken/kitchen-cache:latest'
|
40
|
-
default_config :docker_host_url, default_docker_host
|
41
42
|
default_config :dns, nil
|
42
43
|
default_config :dns_search, nil
|
43
|
-
default_config :
|
44
|
-
default_config :
|
45
|
-
default_config :api_retries, 20
|
46
|
-
# docker run args
|
47
|
-
default_config :privileged, false
|
44
|
+
default_config :docker_host_url, default_docker_host
|
45
|
+
default_config :forward, nil
|
48
46
|
default_config :hostname, nil
|
49
|
-
default_config :
|
47
|
+
default_config :image_prefix, nil
|
50
48
|
default_config :links, nil
|
51
|
-
default_config :cap_add, nil
|
52
|
-
default_config :cap_drop, nil
|
53
|
-
default_config :security_opt, nil
|
54
|
-
default_config :forward, nil
|
55
49
|
default_config :network_mode, 'bridge'
|
50
|
+
default_config :pid_one_command, 'sh -c "trap exit 0 SIGTERM; while :; do sleep 1; done"'
|
51
|
+
default_config :privileged, false
|
52
|
+
default_config :read_timeout, 3600
|
53
|
+
default_config :security_opt, nil
|
54
|
+
default_config :volumes, nil
|
55
|
+
default_config :write_timeout, 3600
|
56
56
|
|
57
57
|
# (see Base#create)
|
58
58
|
def create(state)
|
@@ -134,7 +134,7 @@ module Kitchen
|
|
134
134
|
docker_connection
|
135
135
|
)
|
136
136
|
rescue
|
137
|
-
raise
|
137
|
+
raise 'work_image build failed'
|
138
138
|
end
|
139
139
|
|
140
140
|
state[:work_image] = work_image
|
@@ -192,11 +192,47 @@ module Kitchen
|
|
192
192
|
instance_name
|
193
193
|
end
|
194
194
|
|
195
|
+
class PartialHash < Hash
|
196
|
+
def ==(other)
|
197
|
+
other.is_a?(Hash) && all? { |key, val| other.key?(key) && other[key] == val }
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
195
201
|
def dokken_binds
|
196
202
|
ret = []
|
197
203
|
ret << "#{dokken_sandbox_path}:/opt/kitchen" unless dokken_sandbox_path.nil?
|
198
|
-
ret
|
199
|
-
ret
|
204
|
+
ret << Array(config[:binds]) unless config[:binds].nil?
|
205
|
+
ret.flatten
|
206
|
+
end
|
207
|
+
|
208
|
+
def dokken_volumes
|
209
|
+
coerce_volumes(config[:volumes])
|
210
|
+
end
|
211
|
+
|
212
|
+
def coerce_volumes(v)
|
213
|
+
case v
|
214
|
+
when PartialHash, nil
|
215
|
+
v
|
216
|
+
when Hash
|
217
|
+
PartialHash[v]
|
218
|
+
else
|
219
|
+
b = []
|
220
|
+
v = Array(v).to_a # in case v.is_A?(Chef::Node::ImmutableArray)
|
221
|
+
v.delete_if do |x|
|
222
|
+
parts = x.split(':')
|
223
|
+
b << x if parts.length > 1
|
224
|
+
end
|
225
|
+
b = nil if b.empty?
|
226
|
+
config[:binds] << b unless b.nil?
|
227
|
+
return PartialHash.new if v.empty?
|
228
|
+
v.each_with_object(PartialHash.new) { |volume, h| h[volume] = {} }
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def dokken_volumes_from
|
233
|
+
ret = []
|
234
|
+
ret << chef_container_name
|
235
|
+
ret << data_container_name if remote_docker_host?
|
200
236
|
end
|
201
237
|
|
202
238
|
def start_runner_container(state)
|
@@ -207,12 +243,10 @@ module Kitchen
|
|
207
243
|
'Image' => "#{repo(work_image)}:#{tag(work_image)}",
|
208
244
|
'Hostname' => config[:hostname],
|
209
245
|
'ExposedPorts' => exposed_ports({}, config[:forward]),
|
246
|
+
'Volumes' => dokken_volumes,
|
210
247
|
'HostConfig' => {
|
211
248
|
'Privileged' => config[:privileged],
|
212
|
-
'VolumesFrom' =>
|
213
|
-
chef_container_name,
|
214
|
-
# data_container_name
|
215
|
-
],
|
249
|
+
'VolumesFrom' => dokken_volumes_from,
|
216
250
|
'Binds' => dokken_binds,
|
217
251
|
'Dns' => config[:dns],
|
218
252
|
'DnsSearch' => config[:dns_search],
|
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: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean OMeara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|