test-kitchen 2.5.2 → 2.7.1
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 +0 -11
- data/Rakefile +1 -3
- data/bin/kitchen +1 -3
- data/lib/kitchen.rb +1 -2
- data/lib/kitchen/base64_stream.rb +0 -1
- data/lib/kitchen/cli.rb +2 -2
- data/lib/kitchen/collection.rb +0 -1
- data/lib/kitchen/color.rb +0 -1
- data/lib/kitchen/command.rb +0 -1
- data/lib/kitchen/command/action.rb +1 -2
- data/lib/kitchen/command/console.rb +0 -1
- data/lib/kitchen/command/diagnose.rb +1 -2
- data/lib/kitchen/command/doctor.rb +0 -1
- data/lib/kitchen/command/exec.rb +0 -1
- data/lib/kitchen/command/list.rb +1 -2
- data/lib/kitchen/command/login.rb +0 -1
- data/lib/kitchen/command/package.rb +0 -1
- data/lib/kitchen/command/sink.rb +0 -1
- data/lib/kitchen/command/test.rb +1 -2
- data/lib/kitchen/config.rb +0 -1
- data/lib/kitchen/configurable.rb +0 -1
- data/lib/kitchen/data_munger.rb +0 -1
- data/lib/kitchen/diagnostic.rb +0 -1
- data/lib/kitchen/driver.rb +0 -1
- data/lib/kitchen/driver/base.rb +2 -39
- data/lib/kitchen/driver/dummy.rb +0 -1
- data/lib/kitchen/driver/exec.rb +0 -1
- data/lib/kitchen/driver/proxy.rb +0 -1
- data/lib/kitchen/driver/ssh_base.rb +3 -40
- data/lib/kitchen/errors.rb +0 -1
- data/lib/kitchen/generator/init.rb +0 -1
- data/lib/kitchen/instance.rb +41 -15
- data/lib/kitchen/lazy_hash.rb +0 -1
- data/lib/kitchen/lifecycle_hooks.rb +0 -1
- data/lib/kitchen/loader/yaml.rb +2 -3
- data/lib/kitchen/logger.rb +1 -2
- data/lib/kitchen/logging.rb +0 -1
- data/lib/kitchen/login_command.rb +0 -1
- data/lib/kitchen/metadata_chopper.rb +0 -1
- data/lib/kitchen/platform.rb +0 -1
- data/lib/kitchen/plugin.rb +0 -1
- data/lib/kitchen/plugin_base.rb +60 -0
- data/lib/kitchen/provisioner.rb +0 -1
- data/lib/kitchen/provisioner/base.rb +2 -2
- data/lib/kitchen/provisioner/chef/berkshelf.rb +0 -1
- data/lib/kitchen/provisioner/chef/common_sandbox.rb +1 -2
- data/lib/kitchen/provisioner/chef/policyfile.rb +2 -3
- data/lib/kitchen/provisioner/chef_apply.rb +2 -3
- data/lib/kitchen/provisioner/chef_base.rb +25 -13
- data/lib/kitchen/provisioner/chef_solo.rb +4 -1
- data/lib/kitchen/provisioner/chef_zero.rb +0 -1
- data/lib/kitchen/provisioner/dummy.rb +0 -1
- data/lib/kitchen/provisioner/shell.rb +1 -2
- data/lib/kitchen/rake_tasks.rb +0 -1
- data/lib/kitchen/shell_out.rb +1 -2
- data/lib/kitchen/ssh.rb +6 -4
- data/lib/kitchen/state_file.rb +1 -2
- data/lib/kitchen/suite.rb +0 -1
- data/lib/kitchen/thor_tasks.rb +1 -2
- data/lib/kitchen/transport.rb +0 -1
- data/lib/kitchen/transport/base.rb +2 -2
- data/lib/kitchen/transport/dummy.rb +0 -1
- data/lib/kitchen/transport/exec.rb +1 -2
- data/lib/kitchen/transport/ssh.rb +4 -5
- data/lib/kitchen/transport/winrm.rb +3 -4
- data/lib/kitchen/util.rb +0 -1
- data/lib/kitchen/verifier.rb +0 -1
- data/lib/kitchen/verifier/base.rb +2 -2
- data/lib/kitchen/verifier/busser.rb +2 -3
- data/lib/kitchen/verifier/dummy.rb +0 -1
- data/lib/kitchen/verifier/shell.rb +1 -2
- data/lib/kitchen/version.rb +1 -2
- data/lib/vendor/hash_recursive_merge.rb +0 -1
- data/templates/init/kitchen.yml.erb +2 -2
- data/test-kitchen.gemspec +3 -4
- metadata +10 -9
data/lib/kitchen/lazy_hash.rb
CHANGED
data/lib/kitchen/loader/yaml.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,9 +15,9 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "erb"
|
18
|
+
require "erb" unless defined?(Erb)
|
20
19
|
require_relative "../../vendor/hash_recursive_merge"
|
21
|
-
require "yaml"
|
20
|
+
require "yaml" unless defined?(YAML)
|
22
21
|
|
23
22
|
module Kitchen
|
24
23
|
module Loader
|
data/lib/kitchen/logger.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,7 +15,7 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "fileutils"
|
18
|
+
require "fileutils" unless defined?(FileUtils)
|
20
19
|
require "logger"
|
21
20
|
|
22
21
|
module Kitchen
|
data/lib/kitchen/logging.rb
CHANGED
data/lib/kitchen/platform.rb
CHANGED
data/lib/kitchen/plugin.rb
CHANGED
@@ -0,0 +1,60 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
3
|
+
#
|
4
|
+
# Copyright (C) 2014, Fletcher Nichol
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
module Kitchen
|
19
|
+
module Plugin
|
20
|
+
class Base
|
21
|
+
class << self
|
22
|
+
# @return [Array<Symbol>] an array of action method names that cannot
|
23
|
+
# be run concurrently and must be run in serial via a shared mutex
|
24
|
+
attr_reader :serial_actions
|
25
|
+
end
|
26
|
+
|
27
|
+
# Registers certain driver actions that cannot be safely run concurrently
|
28
|
+
# in threads across multiple instances. Typically this might be used
|
29
|
+
# for create or destroy actions that use an underlying resource that
|
30
|
+
# cannot be used at the same time.
|
31
|
+
#
|
32
|
+
# A shared mutex for this driver object will be used to synchronize all
|
33
|
+
# registered methods.
|
34
|
+
#
|
35
|
+
# @example a single action method that cannot be run concurrently
|
36
|
+
#
|
37
|
+
# no_parallel_for :create
|
38
|
+
#
|
39
|
+
# @example multiple action methods that cannot be run concurrently
|
40
|
+
#
|
41
|
+
# no_parallel_for :create, :destroy
|
42
|
+
#
|
43
|
+
# @param methods [Array<Symbol>] one or more actions as symbols
|
44
|
+
# @raise [ClientError] if any method is not a valid action method name
|
45
|
+
def self.no_parallel_for(*methods)
|
46
|
+
action_methods = %i{create setup converge verify destroy}
|
47
|
+
|
48
|
+
Array(methods).each do |meth|
|
49
|
+
next if action_methods.include?(meth)
|
50
|
+
|
51
|
+
raise ClientError, "##{meth} is not a valid no_parallel_for method"
|
52
|
+
end
|
53
|
+
|
54
|
+
@serial_actions ||= []
|
55
|
+
@serial_actions += methods
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/kitchen/provisioner.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -19,13 +18,14 @@
|
|
19
18
|
require_relative "../configurable"
|
20
19
|
require_relative "../errors"
|
21
20
|
require_relative "../logging"
|
21
|
+
require_relative "../plugin_base"
|
22
22
|
|
23
23
|
module Kitchen
|
24
24
|
module Provisioner
|
25
25
|
# Base class for a provisioner.
|
26
26
|
#
|
27
27
|
# @author Fletcher Nichol <fnichol@nichol.ca>
|
28
|
-
class Base
|
28
|
+
class Base < Kitchen::Plugin::Base
|
29
29
|
include Configurable
|
30
30
|
include Logging
|
31
31
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,7 +15,7 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "json"
|
18
|
+
require "json" unless defined?(JSON)
|
20
19
|
|
21
20
|
module Kitchen
|
22
21
|
module Provisioner
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,8 +15,8 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "shellwords"
|
20
|
-
require "rbconfig"
|
18
|
+
require "shellwords" unless defined?(Shellwords)
|
19
|
+
require "rbconfig" unless defined?(RbConfig)
|
21
20
|
|
22
21
|
require_relative "../../errors"
|
23
22
|
require_relative "../../logging"
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: SAWANOBORI Yukihiko <sawanoboriyu@higanworks.com>)
|
4
3
|
#
|
@@ -30,8 +29,8 @@
|
|
30
29
|
# name: chef_apply
|
31
30
|
#
|
32
31
|
# platforms:
|
33
|
-
# - name: ubuntu-
|
34
|
-
# - name: centos-
|
32
|
+
# - name: ubuntu-20.04
|
33
|
+
# - name: centos-8
|
35
34
|
#
|
36
35
|
# suites:
|
37
36
|
# - name: default
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,18 +15,18 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "fileutils"
|
20
|
-
require "pathname"
|
21
|
-
require "json"
|
22
|
-
require "cgi"
|
18
|
+
require "fileutils" unless defined?(FileUtils)
|
19
|
+
require "pathname" unless defined?(Pathname)
|
20
|
+
require "json" unless defined?(JSON)
|
21
|
+
require "cgi" unless defined?(CGI)
|
23
22
|
|
24
23
|
require_relative "chef/policyfile"
|
25
24
|
require_relative "chef/berkshelf"
|
26
25
|
require_relative "chef/common_sandbox"
|
27
26
|
require_relative "../util"
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
module LicenseAcceptance
|
28
|
+
autoload :Acceptor, "license_acceptance/acceptor"
|
29
|
+
end
|
31
30
|
|
32
31
|
begin
|
33
32
|
require "chef-config/config"
|
@@ -329,7 +328,7 @@ module Kitchen
|
|
329
328
|
return unless config[:require_chef_omnibus] || config[:product_name]
|
330
329
|
return if config[:product_name] && config[:install_strategy] == "skip"
|
331
330
|
|
332
|
-
prefix_command(
|
331
|
+
prefix_command(install_script_contents)
|
333
332
|
end
|
334
333
|
|
335
334
|
private
|
@@ -504,6 +503,7 @@ module Kitchen
|
|
504
503
|
# @return [String] contents of product based install script
|
505
504
|
# @api private
|
506
505
|
def script_for_product
|
506
|
+
require "mixlib/install"
|
507
507
|
installer = Mixlib::Install.new({
|
508
508
|
product_name: config[:product_name],
|
509
509
|
product_version: config[:product_version],
|
@@ -517,6 +517,12 @@ module Kitchen
|
|
517
517
|
opts[key] = config[key] if config[key]
|
518
518
|
end
|
519
519
|
|
520
|
+
unless windows_os?
|
521
|
+
# omnitruck installer does not currently support a tmp dir option on windows
|
522
|
+
opts[:install_command_options][:tmp_dir] = config[:root_path]
|
523
|
+
opts[:install_command_options]["TMPDIR"] = config[:root_path]
|
524
|
+
end
|
525
|
+
|
520
526
|
if config[:download_url]
|
521
527
|
opts[:install_command_options][:download_url_override] = config[:download_url]
|
522
528
|
opts[:install_command_options][:checksum] = config[:checksum] if config[:checksum]
|
@@ -535,7 +541,6 @@ module Kitchen
|
|
535
541
|
# install.ps1 only supports http_proxy
|
536
542
|
prox.delete_if { |p| %i{https_proxy ftp_proxy no_proxy}.include?(p) } if powershell_shell?
|
537
543
|
end
|
538
|
-
|
539
544
|
opts[:install_command_options].merge!(proxies)
|
540
545
|
end)
|
541
546
|
config[:chef_omnibus_root] = installer.root
|
@@ -554,8 +559,14 @@ module Kitchen
|
|
554
559
|
end
|
555
560
|
|
556
561
|
def install_from_file(command)
|
557
|
-
install_file = "/
|
558
|
-
script = [
|
562
|
+
install_file = "#{config[:root_path]}/chef-installer.sh"
|
563
|
+
script = []
|
564
|
+
script << "mkdir -p #{config[:root_path]}"
|
565
|
+
script << "if [ $? -ne 0 ]; then"
|
566
|
+
script << " echo Kitchen config setting root_path: '#{config[:root_path]}' not creatable by regular user "
|
567
|
+
script << " exit 1"
|
568
|
+
script << "fi"
|
569
|
+
script << "cat > #{install_file} <<\"EOL\""
|
559
570
|
script << command
|
560
571
|
script << "EOL"
|
561
572
|
script << "chmod +x #{install_file}"
|
@@ -566,11 +577,12 @@ module Kitchen
|
|
566
577
|
# @return [String] contents of version based install script
|
567
578
|
# @api private
|
568
579
|
def script_for_omnibus_version
|
580
|
+
require "mixlib/install/script_generator"
|
569
581
|
installer = Mixlib::Install::ScriptGenerator.new(
|
570
582
|
config[:require_chef_omnibus], powershell_shell?, install_options
|
571
583
|
)
|
572
584
|
config[:chef_omnibus_root] = installer.root
|
573
|
-
installer.install_command
|
585
|
+
sudo(installer.install_command)
|
574
586
|
end
|
575
587
|
|
576
588
|
# Hook used in subclasses to indicate support for policyfiles.
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -28,6 +27,10 @@ module Kitchen
|
|
28
27
|
|
29
28
|
plugin_version Kitchen::VERSION
|
30
29
|
|
30
|
+
# ChefSolo is dependent on Berkshelf, which is not thread-safe.
|
31
|
+
# See discussion on https://github.com/test-kitchen/test-kitchen/issues/1307
|
32
|
+
no_parallel_for :converge
|
33
|
+
|
31
34
|
default_config :solo_rb, {}
|
32
35
|
|
33
36
|
default_config :chef_solo_path do |provisioner|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Chris Lundquist (<chris.lundquist@github.com>)
|
4
3
|
#
|
@@ -16,7 +15,7 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "shellwords"
|
18
|
+
require "shellwords" unless defined?(Shellwords)
|
20
19
|
|
21
20
|
require_relative "base"
|
22
21
|
require_relative "../version"
|
data/lib/kitchen/rake_tasks.rb
CHANGED
data/lib/kitchen/shell_out.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,7 +15,7 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "mixlib/shellout"
|
18
|
+
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
|
20
19
|
|
21
20
|
module Kitchen
|
22
21
|
# Mixin that wraps a command shell out invocation, providing a #run_command
|
data/lib/kitchen/ssh.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -17,9 +16,10 @@
|
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
18
|
require "logger"
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
module Net
|
20
|
+
autoload :SSH, "net/ssh"
|
21
|
+
end
|
22
|
+
require "socket" unless defined?(Socket)
|
23
23
|
|
24
24
|
require_relative "errors"
|
25
25
|
require_relative "login_command"
|
@@ -91,6 +91,7 @@ module Kitchen
|
|
91
91
|
# `Net::SCP.upload`
|
92
92
|
# @see http://net-ssh.github.io/net-scp/classes/Net/SCP.html#method-i-upload
|
93
93
|
def upload!(local, remote, options = {}, &progress)
|
94
|
+
require "net/scp" unless defined?(Net::SCP)
|
94
95
|
if progress.nil?
|
95
96
|
progress = lambda do |_ch, name, sent, total|
|
96
97
|
logger.debug("Uploaded #{name} (#{total} bytes)") if sent == total
|
@@ -101,6 +102,7 @@ module Kitchen
|
|
101
102
|
end
|
102
103
|
|
103
104
|
def upload(local, remote, options = {}, &progress)
|
105
|
+
require "net/scp" unless defined?(Net::SCP)
|
104
106
|
if progress.nil?
|
105
107
|
progress = lambda do |_ch, name, sent, total|
|
106
108
|
if sent == total
|
data/lib/kitchen/state_file.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,7 +15,7 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
|
18
|
+
autoload :YAML, "yaml"
|
20
19
|
|
21
20
|
module Kitchen
|
22
21
|
# Exception class for any exceptions raised when reading and parsing a state
|
data/lib/kitchen/suite.rb
CHANGED
data/lib/kitchen/thor_tasks.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
#
|
3
2
|
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
4
3
|
#
|
@@ -16,7 +15,7 @@
|
|
16
15
|
# See the License for the specific language governing permissions and
|
17
16
|
# limitations under the License.
|
18
17
|
|
19
|
-
require "thor"
|
18
|
+
require "thor" unless defined?(Thor)
|
20
19
|
|
21
20
|
require_relative "../kitchen"
|
22
21
|
|
data/lib/kitchen/transport.rb
CHANGED