test-kitchen 2.1.0 → 2.2.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/provisioner/base.rb +7 -0
- data/lib/kitchen/provisioner/chef_apply.rb +1 -0
- data/lib/kitchen/provisioner/chef_base.rb +19 -0
- data/lib/kitchen/provisioner/chef_solo.rb +1 -1
- data/lib/kitchen/provisioner/chef_zero.rb +3 -0
- data/lib/kitchen/version.rb +1 -1
- data/test-kitchen.gemspec +14 -11
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e0456b45cb33179d229ccb9ee34371fdbace78b49ec713848091ef9122310c7
|
4
|
+
data.tar.gz: c9bc3d72ca6f8a516b74a8a679a6a37e11e22aec43e3b314a69f77bfe76afc37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a04ad019828982de7f398baa04af63111131955ce1373761ce9d787590b149a8cc8a0a251255798930541904501737d9d35b6f1fbb057ac13963608826b509c
|
7
|
+
data.tar.gz: c6b4e203f029a53295dcc5734d1fbd432ff5bd0817707a674645189bc08e70d83dbb2cc593ea8b0a1dc30fd3f24938cfa4295c539ece0ac4f4031f1e9bb16e88
|
@@ -70,6 +70,7 @@ module Kitchen
|
|
70
70
|
def call(state)
|
71
71
|
create_sandbox
|
72
72
|
sandbox_dirs = Util.list_directory(sandbox_path)
|
73
|
+
check_license
|
73
74
|
|
74
75
|
instance.transport.connection(state) do |conn|
|
75
76
|
conn.execute(install_command)
|
@@ -105,6 +106,12 @@ module Kitchen
|
|
105
106
|
false
|
106
107
|
end
|
107
108
|
|
109
|
+
# Certain products that Test Kitchen uses to provision require accepting
|
110
|
+
# a license to use. Overwrite this method in the specific provisioner
|
111
|
+
# to implement this check.
|
112
|
+
def check_license
|
113
|
+
end
|
114
|
+
|
108
115
|
# Generates a command string which will install and configure the
|
109
116
|
# provisioner software on an instance. If no work is required, then `nil`
|
110
117
|
# will be returned.
|
@@ -27,6 +27,7 @@ require "kitchen/provisioner/chef/common_sandbox"
|
|
27
27
|
require "kitchen/util"
|
28
28
|
require "mixlib/install"
|
29
29
|
require "mixlib/install/script_generator"
|
30
|
+
require "license_acceptance/acceptor"
|
30
31
|
|
31
32
|
begin
|
32
33
|
require "chef-config/config"
|
@@ -44,6 +45,7 @@ module Kitchen
|
|
44
45
|
default_config :require_chef_omnibus, true
|
45
46
|
default_config :chef_omnibus_url, "https://omnitruck.chef.io/install.sh"
|
46
47
|
default_config :chef_omnibus_install_options, nil
|
48
|
+
default_config :chef_license, nil
|
47
49
|
default_config :run_list, []
|
48
50
|
default_config :attributes, {}
|
49
51
|
default_config :config_path, nil
|
@@ -243,6 +245,23 @@ module Kitchen
|
|
243
245
|
end
|
244
246
|
end
|
245
247
|
|
248
|
+
# (see Base#check_license)
|
249
|
+
def check_license
|
250
|
+
name = config[:product_name]
|
251
|
+
version = config[:product_version]
|
252
|
+
acceptor = LicenseAcceptance::Acceptor.new(logger: Kitchen.logger, provided: config[:chef_license])
|
253
|
+
if acceptor.license_required?(name, version)
|
254
|
+
license_name = acceptor.name_from_mixlib(name)
|
255
|
+
begin
|
256
|
+
acceptor.check_and_persist(license_name, version.to_s)
|
257
|
+
rescue LicenseAcceptance::LicenseNotAcceptedError
|
258
|
+
error("Cannot converge without accepting the Chef License. Set it in your kitchen.yml or using the CHEF_LICENSE environment variable")
|
259
|
+
raise
|
260
|
+
end
|
261
|
+
config[:chef_license] ||= acceptor.acceptance_value
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
246
265
|
# (see Base#create_sandbox)
|
247
266
|
def create_sandbox
|
248
267
|
super
|
@@ -72,7 +72,7 @@ module Kitchen
|
|
72
72
|
args << "--logfile #{config[:log_file]}" if config[:log_file]
|
73
73
|
args << "--profile-ruby" if config[:profile_ruby]
|
74
74
|
args << "--legacy-mode" if config[:legacy_mode]
|
75
|
-
|
75
|
+
args << "--chef-license #{config[:chef_license]}" if config[:chef_license]
|
76
76
|
args
|
77
77
|
end
|
78
78
|
end
|
@@ -82,6 +82,9 @@ module Kitchen
|
|
82
82
|
args << "--chef-zero-port #{config[:chef_zero_port]}"
|
83
83
|
end
|
84
84
|
args << "--profile-ruby" if config[:profile_ruby]
|
85
|
+
if config[:chef_license]
|
86
|
+
args << "--chef-license #{config[:chef_license]}"
|
87
|
+
end
|
85
88
|
end
|
86
89
|
# rubocop:enable Metrics/CyclomaticComplexity
|
87
90
|
|
data/lib/kitchen/version.rb
CHANGED
data/test-kitchen.gemspec
CHANGED
@@ -23,17 +23,20 @@ Gem::Specification.new do |gem|
|
|
23
23
|
|
24
24
|
gem.required_ruby_version = ">= 2.3"
|
25
25
|
|
26
|
-
gem.add_dependency "mixlib-shellout",
|
27
|
-
gem.add_dependency "net-scp",
|
28
|
-
gem.add_dependency "net-ssh",
|
29
|
-
gem.add_dependency "net-ssh-gateway",
|
30
|
-
gem.add_dependency "ed25519",
|
31
|
-
gem.add_dependency "bcrypt_pbkdf",
|
32
|
-
gem.add_dependency "thor",
|
33
|
-
gem.add_dependency "mixlib-install",
|
34
|
-
gem.add_dependency "winrm",
|
35
|
-
gem.add_dependency "winrm-elevated",
|
36
|
-
gem.add_dependency "winrm-fs",
|
26
|
+
gem.add_dependency "mixlib-shellout", ">= 1.2", "< 3.0"
|
27
|
+
gem.add_dependency "net-scp", ">= 1.1", "< 3.0" # pinning until we can confirm 3+ works
|
28
|
+
gem.add_dependency "net-ssh", ">= 2.9", "< 6.0" # pinning until we can confirm 6+ works
|
29
|
+
gem.add_dependency "net-ssh-gateway", ">= 1.2", "< 3.0" # pinning until we can confirm 3+ works
|
30
|
+
gem.add_dependency "ed25519", "~> 1.2" # ed25519 ssh key support
|
31
|
+
gem.add_dependency "bcrypt_pbkdf", "~> 1.0" # ed25519 ssh key support
|
32
|
+
gem.add_dependency "thor", "~> 0.19"
|
33
|
+
gem.add_dependency "mixlib-install", "~> 3.6"
|
34
|
+
gem.add_dependency "winrm", "~> 2.0"
|
35
|
+
gem.add_dependency "winrm-elevated", "~> 1.0"
|
36
|
+
gem.add_dependency "winrm-fs", "~> 1.1"
|
37
|
+
# Required to run the Chef provisioner local license check for remote systems
|
38
|
+
# TK is not under Chef EULA
|
39
|
+
gem.add_dependency "license-acceptance", ">= 0.2.16", "< 2.0"
|
37
40
|
|
38
41
|
gem.add_development_dependency "rb-readline"
|
39
42
|
gem.add_development_dependency "bundler"
|
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: 2.
|
4
|
+
version: 2.2.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: 2019-04-
|
11
|
+
date: 2019-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -188,6 +188,26 @@ dependencies:
|
|
188
188
|
- - "~>"
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '1.1'
|
191
|
+
- !ruby/object:Gem::Dependency
|
192
|
+
name: license-acceptance
|
193
|
+
requirement: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - ">="
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: 0.2.16
|
198
|
+
- - "<"
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '2.0'
|
201
|
+
type: :runtime
|
202
|
+
prerelease: false
|
203
|
+
version_requirements: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: 0.2.16
|
208
|
+
- - "<"
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: '2.0'
|
191
211
|
- !ruby/object:Gem::Dependency
|
192
212
|
name: rb-readline
|
193
213
|
requirement: !ruby/object:Gem::Requirement
|