kitchen-inspec 1.3.1 → 2.3.0
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 +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c1940625ae539de46cf0046bca2290acf91d138d7fbe2ee43f904c904676104
|
4
|
+
data.tar.gz: b1a59f220fbc714609035888791a94935bdfd9b018fbf77a17704ad9262b2baf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6fa1b9cd9e0504709cd6a93dc86bba032c10459e8c3c45d983b40cc94cb9c69a79d7a54781465c6c46ba9b1eb888f25782d472e420f96e2d07f8821b12399aa
|
7
|
+
data.tar.gz: 25cf73132b7f783e8debb944ab2dd4f95c779a966004a264aacfb2675a28f6d7778ed4973770be7d4c8ba04627141128b8d6b114d347b493a6ab58a572ec71a4
|
@@ -26,6 +26,8 @@ require "uri"
|
|
26
26
|
require "pathname"
|
27
27
|
require "hashie"
|
28
28
|
|
29
|
+
require "inspec/plugin/v2"
|
30
|
+
|
29
31
|
module Kitchen
|
30
32
|
module Verifier
|
31
33
|
# InSpec verifier for Kitchen.
|
@@ -35,7 +37,14 @@ module Kitchen
|
|
35
37
|
kitchen_verifier_api_version 1
|
36
38
|
plugin_version Kitchen::Verifier::INSPEC_VERSION
|
37
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
|
+
|
38
45
|
default_config :inspec_tests, []
|
46
|
+
default_config :load_plugins, true
|
47
|
+
default_config :backend_cache, true
|
39
48
|
|
40
49
|
# A lifecycle method that should be invoked when the object is about
|
41
50
|
# ready to be used. A reference to an Instance is required as
|
@@ -77,6 +86,17 @@ module Kitchen
|
|
77
86
|
::Inspec::Log.init(STDERR)
|
78
87
|
::Inspec::Log.level = Kitchen::Util.from_logger_level(logger.level)
|
79
88
|
|
89
|
+
# load plugins
|
90
|
+
if config[:load_plugins]
|
91
|
+
v2_loader = ::Inspec::Plugin::V2::Loader.new
|
92
|
+
v2_loader.load_all
|
93
|
+
v2_loader.exit_on_load_error
|
94
|
+
|
95
|
+
if ::Inspec::InputRegistry.instance.respond_to?(:cache_inputs=) && config[:cache_inputs]
|
96
|
+
::Inspec::InputRegistry.instance.cache_inputs = !!config[:cache_inputs]
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
80
100
|
# initialize runner
|
81
101
|
runner = ::Inspec::Runner.new(opts)
|
82
102
|
|
@@ -84,7 +104,7 @@ module Kitchen
|
|
84
104
|
tests = collect_tests
|
85
105
|
profile_ctx = nil
|
86
106
|
tests.each do |target|
|
87
|
-
profile_ctx = runner.add_target(target
|
107
|
+
profile_ctx = runner.add_target(target)
|
88
108
|
end
|
89
109
|
|
90
110
|
profile_ctx ||= []
|
@@ -148,7 +168,7 @@ module Kitchen
|
|
148
168
|
#
|
149
169
|
# we support the base directories
|
150
170
|
# - test/integration
|
151
|
-
# - test/integration/inspec (
|
171
|
+
# - test/integration/inspec (preferred if used with other test environments)
|
152
172
|
#
|
153
173
|
# we do not filter for specific directories, this is core of inspec
|
154
174
|
#
|
@@ -281,7 +301,7 @@ module Kitchen
|
|
281
301
|
# @api private
|
282
302
|
def runner_options_for_winrm(config_data)
|
283
303
|
kitchen = instance.transport.send(:connection_options, config_data).dup
|
284
|
-
|
304
|
+
{
|
285
305
|
"backend" => "winrm",
|
286
306
|
"logger" => logger,
|
287
307
|
"ssl" => URI(kitchen[:endpoint]).scheme == "https",
|
@@ -294,7 +314,6 @@ module Kitchen
|
|
294
314
|
"connection_retry_sleep" => kitchen[:connection_retry_sleep],
|
295
315
|
"max_wait_until_ready" => kitchen[:max_wait_until_ready],
|
296
316
|
}
|
297
|
-
opts
|
298
317
|
end
|
299
318
|
|
300
319
|
# Returns a configuration Hash that can be passed to a `Inspec::Runner`.
|
@@ -325,11 +344,10 @@ module Kitchen
|
|
325
344
|
# @return [Hash] a configuration hash of string-based keys
|
326
345
|
# @api private
|
327
346
|
def runner_options_for_exec(config_data)
|
328
|
-
|
347
|
+
{
|
329
348
|
"backend" => "local",
|
330
349
|
"logger" => logger,
|
331
350
|
}
|
332
|
-
opts
|
333
351
|
end
|
334
352
|
|
335
353
|
# 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.3.0
|
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: 2021-01-28 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.0'
|
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.0'
|
67
73
|
description: A Test Kitchen Verifier for InSpec
|
68
74
|
email:
|
69
75
|
- info@chef.io
|
@@ -93,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
99
|
- !ruby/object:Gem::Version
|
94
100
|
version: '0'
|
95
101
|
requirements: []
|
96
|
-
rubygems_version: 3.
|
102
|
+
rubygems_version: 3.1.4
|
97
103
|
signing_key:
|
98
104
|
specification_version: 4
|
99
105
|
summary: A Test Kitchen Verifier for InSpec
|