test-kitchen 3.2.2 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/kitchen/driver/ssh_base.rb +1 -1
- data/lib/kitchen/provisioner/base.rb +7 -1
- data/lib/kitchen/provisioner/chef/common_sandbox.rb +4 -2
- data/lib/kitchen/provisioner/chef/policyfile.rb +11 -6
- data/lib/kitchen/transport/base.rb +10 -6
- data/lib/kitchen/transport/winrm.rb +17 -0
- data/lib/kitchen/verifier/base.rb +7 -1
- data/lib/kitchen/version.rb +1 -1
- data/templates/driver/README.md.erb +2 -2
- data/test-kitchen.gemspec +2 -2
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f0f59e09f9a2d65a94c33e6c0e833b7fc86958d88d42ef71f4934196cd809f
|
4
|
+
data.tar.gz: aa0bcc30665a7628da122d74354f113965dbdc86e0b68faa1b275fd30cdbbeb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 726d1016370af32c8a40f8877a51a9ff5c3bc4e7f57952318bdfdb3cd8356c0fe3b326ea67596299447cdbd9c5cf915f1c3f2ec41ea0b88b4427526ff0c99a32
|
7
|
+
data.tar.gz: 40d835a7607f6de437bbdb8cd03c720891bc6d8e9417c986f2e9ef5abeded7c7c4957ef0fff727d16152d0e4a967cfe76e9507b02bfff9489498d02d31c6447a
|
data/Gemfile
CHANGED
@@ -70,7 +70,7 @@ module Kitchen
|
|
70
70
|
def converge(state) # rubocop:disable Metrics/AbcSize
|
71
71
|
provisioner = instance.provisioner
|
72
72
|
provisioner.create_sandbox
|
73
|
-
sandbox_dirs =
|
73
|
+
sandbox_dirs = provisioner.sandbox_dirs
|
74
74
|
|
75
75
|
instance.transport.connection(backcompat_merged_state(state)) do |conn|
|
76
76
|
conn.execute(env_cmd(provisioner.install_command))
|
@@ -70,7 +70,6 @@ module Kitchen
|
|
70
70
|
# rubocop:disable Metrics/AbcSize
|
71
71
|
def call(state)
|
72
72
|
create_sandbox
|
73
|
-
sandbox_dirs = Util.list_directory(sandbox_path)
|
74
73
|
|
75
74
|
instance.transport.connection(state) do |conn|
|
76
75
|
config[:uploads].to_h.each do |locals, remote|
|
@@ -182,6 +181,13 @@ module Kitchen
|
|
182
181
|
"trying to access the path."
|
183
182
|
end
|
184
183
|
|
184
|
+
# Returns the list of items in the sandbox directory
|
185
|
+
#
|
186
|
+
# @return [String] path of items in the sandbox directory
|
187
|
+
def sandbox_dirs
|
188
|
+
Util.list_directory(sandbox_path)
|
189
|
+
end
|
190
|
+
|
185
191
|
# Deletes the sandbox path. Without calling this method, the sandbox path
|
186
192
|
# will persist after the process terminates. In other words, cleanup is
|
187
193
|
# explicit. This method is safe to call multiple times.
|
@@ -289,7 +289,8 @@ module Kitchen
|
|
289
289
|
policyfile, sandbox_path,
|
290
290
|
logger: logger,
|
291
291
|
always_update: config[:always_update_cookbooks],
|
292
|
-
policy_group: policy_group
|
292
|
+
policy_group: policy_group,
|
293
|
+
license: config[:chef_license]
|
293
294
|
)
|
294
295
|
Kitchen.mutex.synchronize do
|
295
296
|
policy.compile
|
@@ -308,7 +309,8 @@ module Kitchen
|
|
308
309
|
policyfile, sandbox_path,
|
309
310
|
logger: logger,
|
310
311
|
always_update: config[:always_update_cookbooks],
|
311
|
-
policy_group: config[:policy_group]
|
312
|
+
policy_group: config[:policy_group],
|
313
|
+
license: config[:chef_license]
|
312
314
|
).resolve
|
313
315
|
end
|
314
316
|
end
|
@@ -41,12 +41,13 @@ module Kitchen
|
|
41
41
|
# cookbooks
|
42
42
|
# @param logger [Kitchen::Logger] a logger to use for output, defaults
|
43
43
|
# to `Kitchen.logger`
|
44
|
-
def initialize(policyfile, path, logger: Kitchen.logger, always_update: false, policy_group: nil)
|
44
|
+
def initialize(policyfile, path, license: nil, logger: Kitchen.logger, always_update: false, policy_group: nil)
|
45
45
|
@policyfile = policyfile
|
46
46
|
@path = path
|
47
47
|
@logger = logger
|
48
48
|
@always_update = always_update
|
49
49
|
@policy_group = policy_group
|
50
|
+
@license = license
|
50
51
|
end
|
51
52
|
|
52
53
|
# Loads the library code required to use the resolver.
|
@@ -62,10 +63,10 @@ module Kitchen
|
|
62
63
|
def resolve
|
63
64
|
if policy_group
|
64
65
|
info("Exporting cookbook dependencies from Policyfile #{path} with policy_group #{policy_group} using `#{cli_path} export`...")
|
65
|
-
run_command("#{cli_path} export #{escape_path(policyfile)} #{escape_path(path)} --policy_group #{policy_group} --force")
|
66
|
+
run_command("#{cli_path} export #{escape_path(policyfile)} #{escape_path(path)} --policy_group #{policy_group} --force --chef-license #{license}")
|
66
67
|
else
|
67
68
|
info("Exporting cookbook dependencies from Policyfile #{path} using `#{cli_path} export`...")
|
68
|
-
run_command("#{cli_path} export #{escape_path(policyfile)} #{escape_path(path)} --force")
|
69
|
+
run_command("#{cli_path} export #{escape_path(policyfile)} #{escape_path(path)} --force --chef-license #{license}")
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
@@ -77,11 +78,11 @@ module Kitchen
|
|
77
78
|
else
|
78
79
|
info("Policy lock file doesn't exist, running `#{cli_path} install` for Policyfile #{policyfile}...")
|
79
80
|
end
|
80
|
-
run_command("#{cli_path} install #{escape_path(policyfile)}")
|
81
|
+
run_command("#{cli_path} install #{escape_path(policyfile)} --chef-license #{license}")
|
81
82
|
|
82
83
|
if always_update
|
83
84
|
info("Updating policy lock using `#{cli_path} update`")
|
84
|
-
run_command("#{cli_path} update #{escape_path(policyfile)}")
|
85
|
+
run_command("#{cli_path} update #{escape_path(policyfile)} --chef-license #{license}")
|
85
86
|
end
|
86
87
|
end
|
87
88
|
|
@@ -114,6 +115,10 @@ module Kitchen
|
|
114
115
|
# @api private
|
115
116
|
attr_reader :policy_group
|
116
117
|
|
118
|
+
# @return [String] name of the chef_license
|
119
|
+
# @api private
|
120
|
+
attr_reader :license
|
121
|
+
|
117
122
|
# Escape spaces in a path in way that works with both Sh (Unix) and
|
118
123
|
# Windows.
|
119
124
|
#
|
@@ -152,7 +157,7 @@ module Kitchen
|
|
152
157
|
def no_cli_found_error
|
153
158
|
@logger.fatal("The `chef` or `chef-cli` executables cannot be found in your " \
|
154
159
|
"PATH. Ensure you have installed Chef Workstation " \
|
155
|
-
"from https://
|
160
|
+
"from https://www.chef.io/downloads/ and that your PATH " \
|
156
161
|
"setting includes the path to the `chef` or `chef-cli` commands.")
|
157
162
|
raise UserError, "Could not find the chef or chef-cli executables in your PATH."
|
158
163
|
end
|
@@ -128,8 +128,8 @@ module Kitchen
|
|
128
128
|
tries += 1
|
129
129
|
debug("Attempting to execute command - try #{tries} of #{max_retries}.")
|
130
130
|
execute(command)
|
131
|
-
rescue
|
132
|
-
if retry?(tries, max_retries, retryable_exit_codes, e
|
131
|
+
rescue Exception => e
|
132
|
+
if retry?(tries, max_retries, retryable_exit_codes, e)
|
133
133
|
close
|
134
134
|
sleep wait_time
|
135
135
|
retry
|
@@ -139,10 +139,14 @@ module Kitchen
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
def retry?(current_try, max_retries, retryable_exit_codes,
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
def retry?(current_try, max_retries, retryable_exit_codes, exception)
|
143
|
+
if exception.is_a?(Kitchen::Transport::TransportFailed)
|
144
|
+
return current_try <= max_retries &&
|
145
|
+
!retryable_exit_codes.nil? &&
|
146
|
+
retryable_exit_codes.flatten.include?(exception.exit_code)
|
147
|
+
end
|
148
|
+
|
149
|
+
false
|
146
150
|
end
|
147
151
|
|
148
152
|
# Builds a LoginCommand which can be used to open an interactive
|
@@ -21,6 +21,7 @@ require "rbconfig" unless defined?(RbConfig)
|
|
21
21
|
require "uri" unless defined?(URI)
|
22
22
|
require_relative "../../kitchen"
|
23
23
|
require "winrm" unless defined?(WinRM::Connection)
|
24
|
+
require "winrm/exceptions" unless defined?(WinRM::WinRMHTTPTransportError)
|
24
25
|
|
25
26
|
module Kitchen
|
26
27
|
module Transport
|
@@ -118,6 +119,22 @@ module Kitchen
|
|
118
119
|
end
|
119
120
|
end
|
120
121
|
|
122
|
+
def retry?(current_try, max_retries, retryable_exit_codes, exception)
|
123
|
+
# Avoid duplicating Kitchen::Transport::Base#retry?
|
124
|
+
result = super
|
125
|
+
return result if result == true
|
126
|
+
|
127
|
+
case exception
|
128
|
+
when WinRM::WinRMHTTPTransportError
|
129
|
+
return current_try <= max_retries &&
|
130
|
+
[400, 500].include?(exception.status_code)
|
131
|
+
when WinRM::WinRMWSManFault
|
132
|
+
return current_try <= max_retries
|
133
|
+
end
|
134
|
+
|
135
|
+
false
|
136
|
+
end
|
137
|
+
|
121
138
|
# (see Base::Connection#login_command)
|
122
139
|
def login_command
|
123
140
|
case RbConfig::CONFIG["host_os"]
|
@@ -65,7 +65,6 @@ module Kitchen
|
|
65
65
|
# @raise [ActionFailed] if the action could not be completed
|
66
66
|
def call(state)
|
67
67
|
create_sandbox
|
68
|
-
sandbox_dirs = Util.list_directory(sandbox_path)
|
69
68
|
|
70
69
|
instance.transport.connection(state) do |conn|
|
71
70
|
conn.execute(install_command)
|
@@ -174,6 +173,13 @@ module Kitchen
|
|
174
173
|
"trying to access the path."
|
175
174
|
end
|
176
175
|
|
176
|
+
# Returns the list of items in the sandbox directory
|
177
|
+
#
|
178
|
+
# @return [String] the absolute path of sandbox directory files
|
179
|
+
def sandbox_dirs
|
180
|
+
Util.list_directory(sandbox_path)
|
181
|
+
end
|
182
|
+
|
177
183
|
# Sets the API version for this verifier. If the verifier does not set
|
178
184
|
# this value, then `nil` will be used and reported.
|
179
185
|
#
|
data/lib/kitchen/version.rb
CHANGED
@@ -58,7 +58,7 @@ Created and maintained by [<%= config[:author] %>][author] (<<%= config[:email]
|
|
58
58
|
|
59
59
|
[author]: https://github.com/enter-github-user
|
60
60
|
[issues]: https://github.com/enter-github-user/<%= config[:gem_name] %>/issues
|
61
|
-
[license]: https://github.com/enter-github-user/<%= config[:gem_name] %>/blob/
|
61
|
+
[license]: https://github.com/enter-github-user/<%= config[:gem_name] %>/blob/main/LICENSE
|
62
62
|
[repo]: https://github.com/enter-github-user/<%= config[:gem_name] %>
|
63
|
-
[driver_usage]:
|
63
|
+
[driver_usage]: https://kitchen.ci/docs/drivers/
|
64
64
|
[chef_omnibus_dl]: http://www.chef.io/chef/install/
|
data/test-kitchen.gemspec
CHANGED
@@ -42,9 +42,9 @@ Gem::Specification.new do |gem|
|
|
42
42
|
gem.add_development_dependency "bundler"
|
43
43
|
gem.add_development_dependency "rake"
|
44
44
|
|
45
|
-
gem.add_development_dependency "aruba", "
|
45
|
+
gem.add_development_dependency "aruba", ">= 0.11", "< 3.0"
|
46
46
|
gem.add_development_dependency "fakefs", "~> 1.0"
|
47
|
-
gem.add_development_dependency "minitest", "~> 5.3", "< 5.
|
47
|
+
gem.add_development_dependency "minitest", "~> 5.3", "< 5.16"
|
48
48
|
gem.add_development_dependency "mocha", "~> 1.1"
|
49
49
|
gem.add_development_dependency "cucumber", ">= 2.1", "< 8.0"
|
50
50
|
gem.add_development_dependency "countloc", "~> 0.4"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test-kitchen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Nichol
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -274,22 +274,22 @@ dependencies:
|
|
274
274
|
name: aruba
|
275
275
|
requirement: !ruby/object:Gem::Requirement
|
276
276
|
requirements:
|
277
|
-
- - "
|
277
|
+
- - ">="
|
278
278
|
- !ruby/object:Gem::Version
|
279
279
|
version: '0.11'
|
280
280
|
- - "<"
|
281
281
|
- !ruby/object:Gem::Version
|
282
|
-
version: '
|
282
|
+
version: '3.0'
|
283
283
|
type: :development
|
284
284
|
prerelease: false
|
285
285
|
version_requirements: !ruby/object:Gem::Requirement
|
286
286
|
requirements:
|
287
|
-
- - "
|
287
|
+
- - ">="
|
288
288
|
- !ruby/object:Gem::Version
|
289
289
|
version: '0.11'
|
290
290
|
- - "<"
|
291
291
|
- !ruby/object:Gem::Version
|
292
|
-
version: '
|
292
|
+
version: '3.0'
|
293
293
|
- !ruby/object:Gem::Dependency
|
294
294
|
name: fakefs
|
295
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -313,7 +313,7 @@ dependencies:
|
|
313
313
|
version: '5.3'
|
314
314
|
- - "<"
|
315
315
|
- !ruby/object:Gem::Version
|
316
|
-
version: '5.
|
316
|
+
version: '5.16'
|
317
317
|
type: :development
|
318
318
|
prerelease: false
|
319
319
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -323,7 +323,7 @@ dependencies:
|
|
323
323
|
version: '5.3'
|
324
324
|
- - "<"
|
325
325
|
- !ruby/object:Gem::Version
|
326
|
-
version: '5.
|
326
|
+
version: '5.16'
|
327
327
|
- !ruby/object:Gem::Dependency
|
328
328
|
name: mocha
|
329
329
|
requirement: !ruby/object:Gem::Requirement
|
@@ -520,7 +520,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
520
520
|
- !ruby/object:Gem::Version
|
521
521
|
version: '0'
|
522
522
|
requirements: []
|
523
|
-
rubygems_version: 3.
|
523
|
+
rubygems_version: 3.3.7
|
524
524
|
signing_key:
|
525
525
|
specification_version: 4
|
526
526
|
summary: Test Kitchen is an integration tool for developing and testing infrastructure
|