kitchen-inspec 2.2.1 → 2.4.3
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 +36 -13
- data/lib/kitchen/verifier/inspec_version.rb +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b9dda4257139cd710cede4065826607394f0a24f5a6c30b749059a755d7ede8
|
4
|
+
data.tar.gz: 660665093f602f5edecac6554be0337fda3ebbeb380ef209e1aa37da25285b58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17de911adb466958a95569da4c03ef79892616e5bee128271acc61a903301dabb1c752c9e212b466f05066b2f471f6fe312e6a497ee6f2378be5cb5e49533144
|
7
|
+
data.tar.gz: 498b1f8392a35f3d80d7a310eaf1ce744f14725bab25647b34503cf44e6a3c43c8dc9a76d95d1a3235cee9853fd19f48d418596428b0c0cb71b1090b58b75d2f
|
@@ -44,6 +44,8 @@ module Kitchen
|
|
44
44
|
|
45
45
|
default_config :inspec_tests, []
|
46
46
|
default_config :load_plugins, true
|
47
|
+
default_config :plugin_config, {}
|
48
|
+
default_config :backend_cache, true
|
47
49
|
|
48
50
|
# A lifecycle method that should be invoked when the object is about
|
49
51
|
# ready to be used. A reference to an Instance is required as
|
@@ -81,29 +83,23 @@ module Kitchen
|
|
81
83
|
# add inputs
|
82
84
|
setup_inputs(opts, config)
|
83
85
|
|
84
|
-
# setup
|
86
|
+
# setup Inspec
|
85
87
|
::Inspec::Log.init(STDERR)
|
86
88
|
::Inspec::Log.level = Kitchen::Util.from_logger_level(logger.level)
|
89
|
+
load_plugins # Must load plugins prior to config validation
|
90
|
+
inspec_config = ::Inspec::Config.new(opts)
|
87
91
|
|
88
|
-
#
|
89
|
-
|
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
|
92
|
+
# handle plugins
|
93
|
+
setup_plugin_config(inspec_config)
|
98
94
|
|
99
95
|
# initialize runner
|
100
|
-
runner = ::Inspec::Runner.new(
|
96
|
+
runner = ::Inspec::Runner.new(inspec_config)
|
101
97
|
|
102
98
|
# add each profile to runner
|
103
99
|
tests = collect_tests
|
104
100
|
profile_ctx = nil
|
105
101
|
tests.each do |target|
|
106
|
-
profile_ctx = runner.add_target(target
|
102
|
+
profile_ctx = runner.add_target(target)
|
107
103
|
end
|
108
104
|
|
109
105
|
profile_ctx ||= []
|
@@ -145,6 +141,32 @@ module Kitchen
|
|
145
141
|
end
|
146
142
|
end
|
147
143
|
|
144
|
+
def load_plugins
|
145
|
+
return unless config[:load_plugins]
|
146
|
+
|
147
|
+
v2_loader = ::Inspec::Plugin::V2::Loader.new
|
148
|
+
v2_loader.load_all
|
149
|
+
v2_loader.exit_on_load_error
|
150
|
+
|
151
|
+
# Suppress input caching or all suites will get identical inputs, not different ones
|
152
|
+
if ::Inspec::InputRegistry.instance.respond_to?(:cache_inputs=) && config[:cache_inputs]
|
153
|
+
::Inspec::InputRegistry.instance.cache_inputs = !!config[:cache_inputs]
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def setup_plugin_config(inspec_config)
|
158
|
+
return unless config[:load_plugins]
|
159
|
+
|
160
|
+
unless inspec_config.respond_to?(:merge_plugin_config)
|
161
|
+
logger.warn("kitchen-inspec: skipping `plugin_config` which requires InSpec version 4.26.2 or higher. Your version: #{::Inspec::VERSION}")
|
162
|
+
return
|
163
|
+
end
|
164
|
+
|
165
|
+
config[:plugin_config].each do |plugin_name, plugin_config|
|
166
|
+
inspec_config.merge_plugin_config(plugin_name, plugin_config)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
148
170
|
# (see Base#load_needed_dependencies!)
|
149
171
|
def load_needed_dependencies!
|
150
172
|
require "inspec"
|
@@ -291,6 +313,7 @@ module Kitchen
|
|
291
313
|
opts["bastion_port"] = kitchen[:ssh_gateway_port] if kitchen[:ssh_gateway_port]
|
292
314
|
opts["key_files"] = kitchen[:keys] unless kitchen[:keys].nil?
|
293
315
|
opts["password"] = kitchen[:password] unless kitchen[:password].nil?
|
316
|
+
opts["forward_agent"] = config[:forward_agent] || kitchen[:forward_agent] if config[:forward_agent] || kitchen[:forward_agent]
|
294
317
|
opts
|
295
318
|
end
|
296
319
|
|
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: 2.
|
4
|
+
version: 2.4.3
|
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-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inspec
|
@@ -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
|