kitchen-inspec 1.2.0 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen/verifier/inspec.rb +24 -6
- data/lib/kitchen/verifier/inspec_version.rb +1 -1
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20386a2940c8e28bf2b427d307b2da9bf6f369c322caa16f18da73188c423a6e
|
4
|
+
data.tar.gz: 07b179d4ba4f967ab4924a43a36f709362522db8aad584faa05fc9f493a06c79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f395456c7fb73de0c9f7cc26963c5047ead2fdb971bd5f0ca09151320dafe58993a4530c577df1eb35e101a59a42f09e1d0bcbfa70e14393f71ea1d0cd946d79
|
7
|
+
data.tar.gz: 53af867be8b8bfcf91d04e52780e0fbfe405a2d593809c982385a8cf54ee805b6dbe985a69a263ed8567fc723032cf04fb0e505b27d7a8608cef746ae03716ec
|
@@ -24,6 +24,9 @@ require "kitchen/verifier/base"
|
|
24
24
|
|
25
25
|
require "uri"
|
26
26
|
require "pathname"
|
27
|
+
require "hashie"
|
28
|
+
|
29
|
+
require "inspec/plugin/v2"
|
27
30
|
|
28
31
|
module Kitchen
|
29
32
|
module Verifier
|
@@ -34,7 +37,13 @@ module Kitchen
|
|
34
37
|
kitchen_verifier_api_version 1
|
35
38
|
plugin_version Kitchen::Verifier::INSPEC_VERSION
|
36
39
|
|
40
|
+
# Chef InSpec is based on RSpec, which is not thread safe
|
41
|
+
# (https://github.com/rspec/rspec-core/issues/1254)
|
42
|
+
# Tell test kitchen not to multithread the verify step
|
43
|
+
no_parallel_for :verify
|
44
|
+
|
37
45
|
default_config :inspec_tests, []
|
46
|
+
default_config :load_plugins, true
|
38
47
|
|
39
48
|
# A lifecycle method that should be invoked when the object is about
|
40
49
|
# ready to be used. A reference to an Instance is required as
|
@@ -76,6 +85,17 @@ module Kitchen
|
|
76
85
|
::Inspec::Log.init(STDERR)
|
77
86
|
::Inspec::Log.level = Kitchen::Util.from_logger_level(logger.level)
|
78
87
|
|
88
|
+
# load plugins
|
89
|
+
if config[:load_plugins]
|
90
|
+
v2_loader = ::Inspec::Plugin::V2::Loader.new
|
91
|
+
v2_loader.load_all
|
92
|
+
v2_loader.exit_on_load_error
|
93
|
+
|
94
|
+
if ::Inspec::InputRegistry.instance.respond_to?(:cache_inputs=) && config[:cache_inputs]
|
95
|
+
::Inspec::InputRegistry.instance.cache_inputs = !!config[:cache_inputs]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
79
99
|
# initialize runner
|
80
100
|
runner = ::Inspec::Runner.new(opts)
|
81
101
|
|
@@ -147,7 +167,7 @@ module Kitchen
|
|
147
167
|
#
|
148
168
|
# we support the base directories
|
149
169
|
# - test/integration
|
150
|
-
# - test/integration/inspec (
|
170
|
+
# - test/integration/inspec (preferred if used with other test environments)
|
151
171
|
#
|
152
172
|
# we do not filter for specific directories, this is core of inspec
|
153
173
|
#
|
@@ -184,7 +204,7 @@ module Kitchen
|
|
184
204
|
# leave it alone so it can default to resolving to the Supermarket.
|
185
205
|
unless test_item.keys == [:name]
|
186
206
|
type_keys = [:path, :url, :git, :compliance, :supermarket]
|
187
|
-
git_keys = [:branch, :tag, :ref]
|
207
|
+
git_keys = [:branch, :tag, :ref, :relative_path]
|
188
208
|
supermarket_keys = [:supermarket_url]
|
189
209
|
test_item.delete_if { |k, v| !(type_keys + git_keys + supermarket_keys).include?(k) }
|
190
210
|
end
|
@@ -280,7 +300,7 @@ module Kitchen
|
|
280
300
|
# @api private
|
281
301
|
def runner_options_for_winrm(config_data)
|
282
302
|
kitchen = instance.transport.send(:connection_options, config_data).dup
|
283
|
-
|
303
|
+
{
|
284
304
|
"backend" => "winrm",
|
285
305
|
"logger" => logger,
|
286
306
|
"ssl" => URI(kitchen[:endpoint]).scheme == "https",
|
@@ -293,7 +313,6 @@ module Kitchen
|
|
293
313
|
"connection_retry_sleep" => kitchen[:connection_retry_sleep],
|
294
314
|
"max_wait_until_ready" => kitchen[:max_wait_until_ready],
|
295
315
|
}
|
296
|
-
opts
|
297
316
|
end
|
298
317
|
|
299
318
|
# Returns a configuration Hash that can be passed to a `Inspec::Runner`.
|
@@ -324,11 +343,10 @@ module Kitchen
|
|
324
343
|
# @return [Hash] a configuration hash of string-based keys
|
325
344
|
# @api private
|
326
345
|
def runner_options_for_exec(config_data)
|
327
|
-
|
346
|
+
{
|
328
347
|
"backend" => "local",
|
329
348
|
"logger" => logger,
|
330
349
|
}
|
331
|
-
opts
|
332
350
|
end
|
333
351
|
|
334
352
|
# Returns a configuration Hash that can be passed to a `Inspec::Runner`.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-inspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inspec
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.2.64
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '5.0'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 2.2.64
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '5.0'
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '2.7'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '3'
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '2.7'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '3'
|
@@ -54,16 +54,22 @@ dependencies:
|
|
54
54
|
name: hashie
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '3.4'
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '5'
|
60
63
|
type: :runtime
|
61
64
|
prerelease: false
|
62
65
|
version_requirements: !ruby/object:Gem::Requirement
|
63
66
|
requirements:
|
64
|
-
- - "
|
67
|
+
- - ">="
|
65
68
|
- !ruby/object:Gem::Version
|
66
69
|
version: '3.4'
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '5'
|
67
73
|
description: A Test Kitchen Verifier for InSpec
|
68
74
|
email:
|
69
75
|
- info@chef.io
|