test-kitchen 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/LICENSE +1 -1
- data/Rakefile +2 -2
- data/lib/kitchen/base64_stream.rb +5 -5
- data/lib/kitchen/chef_utils_wiring.rb +2 -2
- data/lib/kitchen/cli.rb +1 -1
- data/lib/kitchen/collection.rb +1 -1
- data/lib/kitchen/color.rb +2 -2
- data/lib/kitchen/command/action.rb +1 -1
- data/lib/kitchen/command/console.rb +1 -1
- data/lib/kitchen/command/diagnose.rb +1 -1
- data/lib/kitchen/command/doctor.rb +1 -1
- data/lib/kitchen/command/exec.rb +1 -1
- data/lib/kitchen/command/list.rb +3 -3
- data/lib/kitchen/command/login.rb +1 -1
- data/lib/kitchen/command/package.rb +1 -1
- data/lib/kitchen/command/sink.rb +1 -1
- data/lib/kitchen/command/test.rb +1 -1
- data/lib/kitchen/command.rb +6 -6
- data/lib/kitchen/config.rb +2 -2
- data/lib/kitchen/configurable.rb +3 -3
- data/lib/kitchen/data_munger.rb +3 -3
- data/lib/kitchen/diagnostic.rb +2 -2
- data/lib/kitchen/driver/base.rb +1 -1
- data/lib/kitchen/driver/dummy.rb +1 -1
- data/lib/kitchen/driver/exec.rb +1 -1
- data/lib/kitchen/driver/proxy.rb +1 -1
- data/lib/kitchen/driver/ssh_base.rb +1 -1
- data/lib/kitchen/driver.rb +1 -1
- data/lib/kitchen/errors.rb +1 -1
- data/lib/kitchen/generator/init.rb +2 -2
- data/lib/kitchen/instance.rb +9 -9
- data/lib/kitchen/lazy_hash.rb +1 -1
- data/lib/kitchen/lifecycle_hooks.rb +1 -1
- data/lib/kitchen/loader/yaml.rb +5 -5
- data/lib/kitchen/logger.rb +1 -1
- data/lib/kitchen/logging.rb +1 -1
- data/lib/kitchen/login_command.rb +2 -2
- data/lib/kitchen/metadata_chopper.rb +1 -1
- data/lib/kitchen/platform.rb +1 -1
- data/lib/kitchen/platform_filter.rb +4 -2
- data/lib/kitchen/plugin.rb +1 -1
- data/lib/kitchen/plugin_base.rb +1 -1
- data/lib/kitchen/provisioner/base.rb +120 -4
- data/lib/kitchen/provisioner/chef/berkshelf.rb +2 -2
- data/lib/kitchen/provisioner/chef/common_sandbox.rb +2 -2
- data/lib/kitchen/provisioner/chef/policyfile.rb +11 -5
- data/lib/kitchen/provisioner/chef_apply.rb +3 -3
- data/lib/kitchen/provisioner/chef_base.rb +7 -7
- data/lib/kitchen/provisioner/chef_infra.rb +2 -2
- data/lib/kitchen/provisioner/chef_solo.rb +1 -1
- data/lib/kitchen/provisioner/chef_target.rb +4 -4
- data/lib/kitchen/provisioner/dummy.rb +1 -1
- data/lib/kitchen/provisioner/shell.rb +1 -1
- data/lib/kitchen/provisioner.rb +1 -1
- data/lib/kitchen/rake_tasks.rb +1 -1
- data/lib/kitchen/shell_out.rb +2 -2
- data/lib/kitchen/ssh.rb +3 -3
- data/lib/kitchen/state_file.rb +2 -2
- data/lib/kitchen/suite.rb +1 -1
- data/lib/kitchen/thor_tasks.rb +1 -1
- data/lib/kitchen/transport/base.rb +1 -1
- data/lib/kitchen/transport/dummy.rb +1 -1
- data/lib/kitchen/transport/exec.rb +2 -2
- data/lib/kitchen/transport/ssh.rb +5 -3
- data/lib/kitchen/transport/winrm.rb +2 -2
- data/lib/kitchen/transport.rb +2 -2
- data/lib/kitchen/util.rb +2 -2
- data/lib/kitchen/verifier/base.rb +2 -2
- data/lib/kitchen/verifier/busser.rb +1 -1
- data/lib/kitchen/verifier/dummy.rb +1 -1
- data/lib/kitchen/verifier/shell.rb +1 -1
- data/lib/kitchen/verifier.rb +1 -1
- data/lib/kitchen/version.rb +2 -2
- data/lib/kitchen/which.rb +1 -1
- data/lib/kitchen.rb +1 -1
- data/lib/vendor/hash_recursive_merge.rb +1 -1
- data/templates/driver/license_apachev2.erb +1 -1
- data/templates/driver/license_lgplv3.erb +1 -1
- data/templates/init/kitchen.yml.erb +2 -2
- data/test-kitchen.gemspec +1 -1
- metadata +5 -5
data/lib/kitchen/logger.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
data/lib/kitchen/logging.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -35,7 +35,7 @@ module Kitchen
|
|
35
35
|
# @param command [String] command
|
36
36
|
# @param arguments [Array] array of arguments to the command
|
37
37
|
# @param options [Hash] options hash, passed to `Kernel#exec`
|
38
|
-
# @see
|
38
|
+
# @see https://ruby-doc.org/core-2.1.2/Kernel.html#method-i-exec
|
39
39
|
def initialize(command, arguments, options = {})
|
40
40
|
@command = command
|
41
41
|
@arguments = Array(arguments)
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
data/lib/kitchen/platform.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -50,7 +50,9 @@ module Kitchen
|
|
50
50
|
#
|
51
51
|
# @param [Regexp,String] value of the filter
|
52
52
|
def initialize(value)
|
53
|
-
|
53
|
+
unless value.is_a?(::Regexp) || value.is_a?(::String)
|
54
|
+
raise ::ArgumentError, "PlatformFilter#new requires value to be a String or a Regexp"
|
55
|
+
end
|
54
56
|
|
55
57
|
@value = value
|
56
58
|
end
|
data/lib/kitchen/plugin.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
# you may not use this file except in compliance with the License.
|
9
9
|
# You may obtain a copy of the License at
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
12
12
|
#
|
13
13
|
# Unless required by applicable law or agreed to in writing, software
|
14
14
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
data/lib/kitchen/plugin_base.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -70,20 +70,39 @@ module Kitchen
|
|
70
70
|
# rubocop:disable Metrics/AbcSize
|
71
71
|
def call(state)
|
72
72
|
create_sandbox
|
73
|
+
prepare_install_script
|
73
74
|
|
74
75
|
instance.transport.connection(state) do |conn|
|
75
76
|
config[:uploads].to_h.each do |locals, remote|
|
76
77
|
debug("Uploading #{Array(locals).join(", ")} to #{remote}")
|
77
78
|
conn.upload(locals.to_s, remote)
|
78
79
|
end
|
79
|
-
|
80
|
+
|
81
|
+
# Run the init command to create the kitchen tmp directory
|
82
|
+
conn.execute(init_command)
|
83
|
+
|
84
|
+
# Upload the install script instead of directly executing the command
|
85
|
+
if install_command
|
86
|
+
script_filename = windows_os? ? "install_script.ps1" : "install_script"
|
87
|
+
remote_script_path = remote_path_join(resolve_remote_path(config[:root_path]), script_filename)
|
88
|
+
if install_script_path
|
89
|
+
debug("Uploading install script to #{remote_script_path}")
|
90
|
+
conn.upload(install_script_path, remote_script_path)
|
91
|
+
# Make script executable on remote host
|
92
|
+
conn.execute(make_executable_command(remote_script_path))
|
93
|
+
# Execute the uploaded script
|
94
|
+
conn.execute(run_script_command(remote_script_path))
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# The install script will remove the kitchen tmp directory, hence creating it again.
|
80
99
|
conn.execute(init_command)
|
81
100
|
info("Transferring files to #{instance.to_str}")
|
82
|
-
conn.upload(sandbox_dirs, config[:root_path])
|
101
|
+
conn.upload(sandbox_dirs, resolve_remote_path(config[:root_path]))
|
83
102
|
debug("Transfer complete")
|
84
103
|
conn.execute(prepare_command)
|
85
104
|
conn.execute_with_retry(
|
86
|
-
run_command,
|
105
|
+
encode_for_powershell(run_command),
|
87
106
|
config[:retry_on_exit_code],
|
88
107
|
config[:max_retries],
|
89
108
|
config[:wait_for_retry]
|
@@ -195,6 +214,7 @@ module Kitchen
|
|
195
214
|
return if sandbox_path.nil?
|
196
215
|
|
197
216
|
debug("Cleaning up local sandbox in #{sandbox_path}")
|
217
|
+
@install_script_path = nil
|
198
218
|
FileUtils.rmtree(sandbox_path)
|
199
219
|
end
|
200
220
|
|
@@ -270,6 +290,102 @@ module Kitchen
|
|
270
290
|
def prefix_command(script)
|
271
291
|
config[:command_prefix] ? "#{config[:command_prefix]} #{script}" : script
|
272
292
|
end
|
293
|
+
|
294
|
+
def encode_for_powershell(script)
|
295
|
+
return script unless windows_os?
|
296
|
+
|
297
|
+
utf16le = script.encode(Encoding::UTF_16LE)
|
298
|
+
encoded = [utf16le].pack("m0")
|
299
|
+
|
300
|
+
"powershell -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -EncodedCommand #{encoded}"
|
301
|
+
end
|
302
|
+
|
303
|
+
# Writes the install command to a file that will be uploaded to the instance
|
304
|
+
# and executed.
|
305
|
+
#
|
306
|
+
# @api private
|
307
|
+
def prepare_install_script
|
308
|
+
command = install_command
|
309
|
+
return if command.nil? || command.empty?
|
310
|
+
|
311
|
+
info("Preparing install script")
|
312
|
+
script_filename = windows_os? ? "install_script.ps1" : "install_script"
|
313
|
+
@install_script_path = File.join(sandbox_path, script_filename)
|
314
|
+
|
315
|
+
debug("Creating install script at #{@install_script_path}")
|
316
|
+
File.open(@install_script_path, "wb") do |file|
|
317
|
+
unless windows_os?
|
318
|
+
file.write("#!/bin/sh\n")
|
319
|
+
end
|
320
|
+
file.write(command)
|
321
|
+
end
|
322
|
+
|
323
|
+
# Make script executable locally
|
324
|
+
FileUtils.chmod(0755, @install_script_path) unless windows_os?
|
325
|
+
end
|
326
|
+
|
327
|
+
def install_script_path
|
328
|
+
@install_script_path
|
329
|
+
end
|
330
|
+
|
331
|
+
# Returns a command to make a script executable on the remote host.
|
332
|
+
#
|
333
|
+
# @param script_path [String] path to the script on the remote host
|
334
|
+
# @return [String] command to make the script executable
|
335
|
+
# @api private
|
336
|
+
def make_executable_command(script_path)
|
337
|
+
debug "echo Making script executable"
|
338
|
+
return if windows_os?
|
339
|
+
|
340
|
+
prefix_command(wrap_shell_code(sudo("chmod +x #{script_path}")))
|
341
|
+
end
|
342
|
+
|
343
|
+
# Returns a command to execute a script on the remote host.
|
344
|
+
#
|
345
|
+
# @param script_path [String] path to the script on the remote host
|
346
|
+
# @return [String] command to execute the script
|
347
|
+
# @api private
|
348
|
+
def run_script_command(script_path)
|
349
|
+
if windows_os?
|
350
|
+
# Use parameters to suppress PowerShell formatting and control characters
|
351
|
+
# that can interfere with console output over SSH
|
352
|
+
"powershell -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -File #{script_path}"
|
353
|
+
else
|
354
|
+
prefix_command(wrap_shell_code(sudo(script_path)))
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
# Resolves PowerShell environment variables in remote paths to actual paths
|
359
|
+
# for use with net/scp and other transport operations that can't handle
|
360
|
+
# PowerShell variables like $env:TEMP.
|
361
|
+
#
|
362
|
+
# @param path [String] the remote path that may contain PowerShell env vars
|
363
|
+
# @return [String] the resolved path
|
364
|
+
# @api private
|
365
|
+
def resolve_remote_path(path)
|
366
|
+
return path unless windows_os?
|
367
|
+
|
368
|
+
# For Windows, resolve common PowerShell environment variables
|
369
|
+
resolved_path = path.dup
|
370
|
+
|
371
|
+
# Replace $env:TEMP with the actual Windows temp directory based on the transport username
|
372
|
+
if resolved_path.include?("$env:TEMP")
|
373
|
+
# Try to get username from transport configuration
|
374
|
+
# For Windows systems, fallback to "Administrator" if not found
|
375
|
+
username = begin
|
376
|
+
instance.transport[:username]
|
377
|
+
rescue
|
378
|
+
nil
|
379
|
+
end
|
380
|
+
username ||= "Administrator"
|
381
|
+
|
382
|
+
temp_path = "C:/Users/#{username}/AppData/Local/Temp"
|
383
|
+
resolved_path = resolved_path.gsub("$env:TEMP", temp_path)
|
384
|
+
end
|
385
|
+
|
386
|
+
# Convert backslashes to forward slashes for cross-platform compatibility
|
387
|
+
resolved_path.tr("\\", "/")
|
388
|
+
end
|
273
389
|
end
|
274
390
|
end
|
275
391
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -87,7 +87,7 @@ module Kitchen
|
|
87
87
|
class << self
|
88
88
|
private
|
89
89
|
|
90
|
-
# Load the Berkshelf-specific
|
90
|
+
# Load the Berkshelf-specific library code.
|
91
91
|
#
|
92
92
|
# @param logger [Kitchen::Logger] the logger to use
|
93
93
|
# @raise [UserError] if the library couldn't be loaded
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -162,7 +162,7 @@ module Kitchen
|
|
162
162
|
info("Removing non-cookbook files before transfer")
|
163
163
|
FileUtils.rm(all_files_in_cookbooks - only_cookbook_files)
|
164
164
|
Util.list_directory(tmpbooks_dir, recurse: true)
|
165
|
-
.reverse_each { |fn| FileUtils.rmdir(fn) if File.directory?(fn) && Dir.
|
165
|
+
.reverse_each { |fn| FileUtils.rmdir(fn) if File.directory?(fn) && Dir.empty?(fn) }
|
166
166
|
end
|
167
167
|
|
168
168
|
# @return [Logger] the instance's logger or Test Kitchen's common
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -63,10 +63,10 @@ module Kitchen
|
|
63
63
|
def resolve
|
64
64
|
if policy_group
|
65
65
|
info("Exporting cookbook dependencies from Policyfile #{path} with policy_group #{policy_group} using `#{cli_path} export`...")
|
66
|
-
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)}")
|
67
67
|
else
|
68
68
|
info("Exporting cookbook dependencies from Policyfile #{path} using `#{cli_path} export`...")
|
69
|
-
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)}")
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -78,11 +78,11 @@ module Kitchen
|
|
78
78
|
else
|
79
79
|
info("Policy lock file doesn't exist, running `#{cli_path} install` for Policyfile #{policyfile}...")
|
80
80
|
end
|
81
|
-
run_command("#{cli_path} install #{escape_path(policyfile)}
|
81
|
+
run_command("#{cli_path} install #{escape_path(policyfile)} #{chef_license(license)}")
|
82
82
|
|
83
83
|
if always_update
|
84
84
|
info("Updating policy lock using `#{cli_path} update`")
|
85
|
-
run_command("#{cli_path} update #{escape_path(policyfile)}
|
85
|
+
run_command("#{cli_path} update #{escape_path(policyfile)} #{chef_license(license)}")
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -161,6 +161,12 @@ module Kitchen
|
|
161
161
|
"setting includes the path to the `chef` or `chef-cli` commands.")
|
162
162
|
raise UserError, "Could not find the chef or chef-cli executables in your PATH."
|
163
163
|
end
|
164
|
+
|
165
|
+
# Return `"--chef-license #{license}"` when `license` is not nil or empty and the empty string otherwise.
|
166
|
+
def chef_license(license)
|
167
|
+
(license.nil? || license.empty?) ? "" : "--chef-license #{license}"
|
168
|
+
end
|
169
|
+
|
164
170
|
end
|
165
171
|
end
|
166
172
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -29,8 +29,8 @@
|
|
29
29
|
# name: chef_apply
|
30
30
|
#
|
31
31
|
# platforms:
|
32
|
-
# - name: ubuntu-
|
33
|
-
# - name:
|
32
|
+
# - name: ubuntu-24.04
|
33
|
+
# - name: almalinux-10
|
34
34
|
#
|
35
35
|
# suites:
|
36
36
|
# - name: default
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -273,7 +273,7 @@ module Kitchen
|
|
273
273
|
# @return [String] license id to prompt for acceptance
|
274
274
|
def license_acceptance_id
|
275
275
|
case
|
276
|
-
when File.exist?(policyfile)
|
276
|
+
when File.exist?(policyfile) && (config[:product_name].nil? || config[:product_name].start_with?("chef"))
|
277
277
|
"chef-workstation"
|
278
278
|
when config[:product_name]
|
279
279
|
config[:product_name]
|
@@ -322,7 +322,7 @@ module Kitchen
|
|
322
322
|
init_command_vars_for_bourne(dirs)
|
323
323
|
end
|
324
324
|
|
325
|
-
prefix_command(shell_code_from_file(vars, "chef_base_init_command"))
|
325
|
+
encode_for_powershell(prefix_command(shell_code_from_file(vars, "chef_base_init_command")))
|
326
326
|
end
|
327
327
|
|
328
328
|
# (see Base#install_command)
|
@@ -392,7 +392,7 @@ module Kitchen
|
|
392
392
|
# @return [Hash] a configuration hash
|
393
393
|
# @api private
|
394
394
|
def default_config_rb # rubocop:disable Metrics/MethodLength
|
395
|
-
root = config[:root_path].gsub("$env:TEMP", "\#{ENV['TEMP']
|
395
|
+
root = config[:root_path].gsub("$env:TEMP", "\#{ENV['TEMP']}")
|
396
396
|
|
397
397
|
config_rb = {
|
398
398
|
node_name: instance.name,
|
@@ -443,7 +443,7 @@ module Kitchen
|
|
443
443
|
if obj.is_a?(String) && obj =~ /^:/
|
444
444
|
obj
|
445
445
|
elsif obj.is_a?(String)
|
446
|
-
%{"#{obj.gsub(
|
446
|
+
%{"#{obj.gsub("\\", "\\\\\\\\")}"}
|
447
447
|
elsif obj.is_a?(Array)
|
448
448
|
%{[#{obj.map { |i| format_value(i) }.join(", ")}]}
|
449
449
|
else
|
@@ -601,12 +601,12 @@ module Kitchen
|
|
601
601
|
# @api private
|
602
602
|
def sanity_check_sandbox_options!
|
603
603
|
if (config[:policyfile_path] || config[:policyfile]) && !File.exist?(policyfile)
|
604
|
-
raise UserError, "policyfile_path set in config "\
|
604
|
+
raise UserError, "policyfile_path set in config " \
|
605
605
|
"(#{config[:policyfile_path]} could not be found. " \
|
606
606
|
"Expected to find it at full path #{policyfile}."
|
607
607
|
end
|
608
608
|
if config[:berksfile_path] && !File.exist?(berksfile)
|
609
|
-
raise UserError, "berksfile_path set in config "\
|
609
|
+
raise UserError, "berksfile_path set in config " \
|
610
610
|
"(#{config[:berksfile_path]} could not be found. " \
|
611
611
|
"Expected to find it at full path #{berksfile}."
|
612
612
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -138,7 +138,7 @@ module Kitchen
|
|
138
138
|
debug("Using a dummy validation.pem")
|
139
139
|
|
140
140
|
source = File.join(File.dirname(__FILE__),
|
141
|
-
|
141
|
+
%w{.. .. .. support dummy-validation.pem})
|
142
142
|
FileUtils.cp(source, File.join(sandbox_path, "validation.pem"))
|
143
143
|
end
|
144
144
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -46,10 +46,10 @@ module Kitchen
|
|
46
46
|
credentials_file = File.join(kitchen_basepath, ".kitchen", instance_name + ".ini")
|
47
47
|
File.write(credentials_file, connection.credentials_file)
|
48
48
|
|
49
|
-
super.
|
49
|
+
super.push(
|
50
50
|
"--target #{instance_name}",
|
51
|
-
"--credentials #{credentials_file}"
|
52
|
-
|
51
|
+
"--credentials #{credentials_file}"
|
52
|
+
)
|
53
53
|
end
|
54
54
|
|
55
55
|
def check_transport(connection)
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
data/lib/kitchen/provisioner.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
# you may not use this file except in compliance with the License.
|
9
9
|
# You may obtain a copy of the License at
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
12
12
|
#
|
13
13
|
# Unless required by applicable law or agreed to in writing, software
|
14
14
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
data/lib/kitchen/rake_tasks.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
data/lib/kitchen/shell_out.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -78,7 +78,7 @@ module Kitchen
|
|
78
78
|
# Returns a hash of MixLib::ShellOut options for the command.
|
79
79
|
#
|
80
80
|
# @param options [Hash] a Hash of options
|
81
|
-
# @return [Hash] a new Hash of options,
|
81
|
+
# @return [Hash] a new Hash of options, filtered and merged with defaults
|
82
82
|
# @api private
|
83
83
|
def shell_opts(options)
|
84
84
|
filtered_opts = options.reject do |key, _value|
|
data/lib/kitchen/ssh.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -92,7 +92,7 @@ module Kitchen
|
|
92
92
|
# @param remote [String] path to remote file destination
|
93
93
|
# @param options [Hash] configuration options that are passed to
|
94
94
|
# `Net::SCP.upload`
|
95
|
-
# @see
|
95
|
+
# @see https://net-ssh.github.io/net-scp/classes/Net/SCP.html#method-i-upload
|
96
96
|
def upload!(local, remote, options = {}, &progress)
|
97
97
|
require "net/scp" unless defined?(Net::SCP)
|
98
98
|
if progress.nil?
|
@@ -124,7 +124,7 @@ module Kitchen
|
|
124
124
|
# @param options [Hash] configuration options that are passed to
|
125
125
|
# `Net::SCP.upload`
|
126
126
|
# @option options [true,false] :recursive recursive copy (default: `true`)
|
127
|
-
# @see
|
127
|
+
# @see https://net-ssh.github.io/net-scp/classes/Net/SCP.html#method-i-upload
|
128
128
|
def upload_path!(local, remote, options = {}, &progress)
|
129
129
|
options = { recursive: true }.merge(options)
|
130
130
|
|
data/lib/kitchen/state_file.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -43,7 +43,7 @@ module Kitchen
|
|
43
43
|
# @raise [StateFileLoadError] if there is a problem loading the state file
|
44
44
|
# from disk and loading it into a Hash
|
45
45
|
def read
|
46
|
-
if File.exist?(file_name) && !File.
|
46
|
+
if File.exist?(file_name) && !File.empty?(file_name)
|
47
47
|
Util.symbolized_hash(deserialize_string(read_file))
|
48
48
|
else
|
49
49
|
{}
|
data/lib/kitchen/suite.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
data/lib/kitchen/thor_tasks.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -8,7 +8,7 @@
|
|
8
8
|
# you may not use this file except in compliance with the License.
|
9
9
|
# You may obtain a copy of the License at
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
12
12
|
#
|
13
13
|
# Unless required by applicable law or agreed to in writing, software
|
14
14
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
11
|
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
4
4
|
# You may obtain a copy of the License at
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
7
7
|
#
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
9
9
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
@@ -59,7 +59,7 @@ module Kitchen
|
|
59
59
|
# @see Base#upload
|
60
60
|
def upload(locals, remote)
|
61
61
|
# evaluate $env:temp on Windows
|
62
|
-
real_remote = remote.to_s == "
|
62
|
+
real_remote = remote.to_s == "$env:TEMP\\kitchen" ? kitchen_temp : remote
|
63
63
|
FileUtils.mkdir_p(real_remote)
|
64
64
|
Array(locals).each do |local|
|
65
65
|
FileUtils.cp_r(local, real_remote)
|