test-kitchen 1.25.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6c10ada5565a14188f81198ab603201f831f7b7237def1517b92695fb851d49
4
- data.tar.gz: 232f4a053884a07eef2edff6415cf4582d76e685464943eebfb547494dd887c6
3
+ metadata.gz: 77640b7351ca31e3fb82454cc038bf093358b16f6a1d98275d28cf7ae8a91d65
4
+ data.tar.gz: fb58807514c09100fd70489fc7db56d305b505f0ee3d44c2a504ccc9cadab23a
5
5
  SHA512:
6
- metadata.gz: 7594aa1002500ab9130b39293fdc795da406202e7438627b2f42fffc29b0d1c17f200ec79fd0c85b69a5a984a4b5062a889c9fdbd1ae685ba435e89e347d80d6
7
- data.tar.gz: 4044d16718fa0b27425c4a0a91fc67ff50f0c77c2fab3266d8b88afaadec3259d67dfe51cb0db0f850410922d0901e081d9c9fcdc3ee5ea1094afd5a6d7fccdd
6
+ metadata.gz: b047ad7cab30721bb5f39921a70436938eda6359aa0e397b2598df284d53e175f87e9e25cf9fa589131ff474382013ea36a2e26736dd011405e23a86d3d16c6d
7
+ data.tar.gz: 0b64d308b0eec60811dff865b52f5f77f9403799e117e82d21c3f77e93ffe2cdefcb10fa49146afc6dc051d85cc452085752aec544ab552e89f1041db65d349d
data/lib/kitchen/cli.rb CHANGED
@@ -186,11 +186,6 @@ module Kitchen
186
186
  default: false,
187
187
  desc: "Run the #{action} with debugging enabled."
188
188
  end
189
- method_option :fail_fast,
190
- aliases: "-f",
191
- type: :boolean,
192
- desc: "Fail immediately when errors occur in concurrency mode"
193
-
194
189
  test_base_path
195
190
  log_options
196
191
  define_method(action) do |*args|
@@ -170,7 +170,6 @@ module Kitchen
170
170
  end
171
171
  end
172
172
  end
173
- Thread.abort_on_exception = true if options[:fail_fast]
174
173
  threads.map(&:join)
175
174
  report_errors
176
175
  end
@@ -405,7 +405,6 @@ module Kitchen
405
405
  if legacy_ssh_base_driver?
406
406
  legacy_ssh_base_converge(state)
407
407
  else
408
- provisioner.check_license
409
408
  provisioner.call(state)
410
409
  end
411
410
  end
@@ -352,14 +352,7 @@ module Kitchen
352
352
  def parse_yaml_string(string, file_name)
353
353
  return {} if string.nil? || string.empty?
354
354
 
355
- result =
356
- if Gem::Requirement.new(">= 3.1.0").satisfied_by?(Gem::Version.new(Psych::VERSION))
357
- # ruby >= 2.6.0
358
- ::YAML.safe_load(string, permitted_classes: [Symbol], permitted_symbols: [], aliases: true) || {}
359
- else
360
- # ruby < 2.6.0
361
- ::YAML.safe_load(string, [Symbol], [], true) || {}
362
- end
355
+ result = ::YAML.safe_load(string, [Symbol], [], true) || {}
363
356
  unless result.is_a?(Hash)
364
357
  raise UserError, "Error parsing #{file_name} as YAML " \
365
358
  "(Result of parse was not a Hash, but was a #{result.class}).\n" \
@@ -105,12 +105,6 @@ module Kitchen
105
105
  false
106
106
  end
107
107
 
108
- # Certain products that Test Kitchen uses to provision require accepting
109
- # a license to use. Overwrite this method in the specific provisioner
110
- # to implement this check.
111
- def check_license
112
- end
113
-
114
108
  # Generates a command string which will install and configure the
115
109
  # provisioner software on an instance. If no work is required, then `nil`
116
110
  # will be returned.
@@ -89,22 +89,14 @@ module Kitchen
89
89
  # @api private
90
90
  def policyfile
91
91
  basename = config[:policyfile_path] || config[:policyfile] || "Policyfile.rb"
92
- File.expand_path(basename, config[:kitchen_root])
92
+ File.join(config[:kitchen_root], basename)
93
93
  end
94
94
 
95
95
  # @return [String] an absolute path to a Berksfile, relative to the
96
96
  # kitchen root
97
97
  # @api private
98
98
  def berksfile
99
- basename = config[:berksfile_path] || "Berksfile"
100
- File.expand_path(basename, config[:kitchen_root])
101
- end
102
-
103
- # @return [String] an absolute path to a Cheffile, relative to the
104
- # kitchen root
105
- # @api private
106
- def cheffile
107
- File.join(config[:kitchen_root], "Cheffile")
99
+ File.join(config[:kitchen_root], "Berksfile")
108
100
  end
109
101
 
110
102
  # @return [String] an absolute path to a cookbooks/ directory, relative
@@ -180,8 +172,8 @@ module Kitchen
180
172
  #
181
173
  # @api private
182
174
  def make_fake_cookbook
183
- info("Policyfile, Berksfile, Cheffile, cookbooks/, or metadata.rb not found " \
184
- "so Chef Infra Client will run, but do nothing. Is this intended?")
175
+ info("Berksfile, cookbooks/, or metadata.rb not found " \
176
+ "so Chef will run with effectively no cookbooks. Is this intended?")
185
177
  name = File.basename(config[:kitchen_root])
186
178
  fake_cb = File.join(tmpbooks_dir, name)
187
179
  FileUtils.mkdir_p(fake_cb)
@@ -258,9 +250,6 @@ module Kitchen
258
250
  resolve_with_policyfile
259
251
  elsif File.exist?(berksfile)
260
252
  resolve_with_berkshelf
261
- elsif File.exist?(cheffile)
262
- resolve_with_librarian
263
- cp_site_cookbooks if File.directory?(site_cookbooks_dir)
264
253
  elsif File.directory?(cookbooks_dir)
265
254
  cp_cookbooks
266
255
  elsif File.exist?(metadata_rb)
@@ -293,7 +282,7 @@ module Kitchen
293
282
 
294
283
  def update_dna_for_policyfile
295
284
  if !config[:run_list].nil? && !config[:run_list].empty?
296
- warn("You must set your run_list in your Policyfile instead of "\
285
+ warn("You must set your run_list in your policyfile instead of "\
297
286
  "kitchen config. The run_list in your config will be ignored.")
298
287
  warn("Ignored run_list: #{config[:run_list].inspect}")
299
288
  end
@@ -330,15 +319,6 @@ module Kitchen
330
319
  end
331
320
  end
332
321
 
333
- # Performs a Librarin-Chef cookbook resolution inside a common mutex.
334
- #
335
- # @api private
336
- def resolve_with_librarian
337
- Kitchen.mutex.synchronize do
338
- Chef::Librarian.new(cheffile, tmpbooks_dir, logger: logger).resolve
339
- end
340
- end
341
-
342
322
  # @return [String] an absolute path to a site-cookbooks/ directory,
343
323
  # relative to the kitchen root
344
324
  # @api private
@@ -87,7 +87,7 @@ module Kitchen
87
87
 
88
88
  private
89
89
 
90
- # @return [String] path to a Policyfile
90
+ # @return [String] path to a Berksfile
91
91
  # @api private
92
92
  attr_reader :policyfile
93
93
 
@@ -139,8 +139,8 @@ module Kitchen
139
139
  File.exist?(File.join(p, "chef"))
140
140
  end
141
141
  logger.fatal("The `chef` executable cannot be found in your " \
142
- "PATH. Ensure you have installed ChefDK or Chef Workstation " \
143
- "from https://downloads.chef.io and that your PATH " \
142
+ "PATH. Ensure you have installed ChefDK from " \
143
+ "https://downloads.chef.io and that your PATH " \
144
144
  "setting includes the path to the `chef` comand.")
145
145
  raise UserError,
146
146
  "Could not find the chef executable in your PATH."
@@ -107,7 +107,6 @@ module Kitchen
107
107
  "--no-color",
108
108
  ]
109
109
  args << "--logfile #{config[:log_file]}" if config[:log_file]
110
- args << "--chef-license #{config[:chef_license]}" if config[:chef_license]
111
110
 
112
111
  lines << wrap_shell_code(
113
112
  [cmd, *args].join(" ")
@@ -24,11 +24,9 @@ require "cgi"
24
24
  require "kitchen/provisioner/chef/policyfile"
25
25
  require "kitchen/provisioner/chef/berkshelf"
26
26
  require "kitchen/provisioner/chef/common_sandbox"
27
- require "kitchen/provisioner/chef/librarian"
28
27
  require "kitchen/util"
29
28
  require "mixlib/install"
30
29
  require "mixlib/install/script_generator"
31
- require "license_acceptance/acceptor"
32
30
 
33
31
  begin
34
32
  require "chef-config/config"
@@ -46,7 +44,6 @@ module Kitchen
46
44
  default_config :require_chef_omnibus, true
47
45
  default_config :chef_omnibus_url, "https://omnitruck.chef.io/install.sh"
48
46
  default_config :chef_omnibus_install_options, nil
49
- default_config :chef_license, nil
50
47
  default_config :run_list, []
51
48
  default_config :attributes, {}
52
49
  default_config :config_path, nil
@@ -60,9 +57,6 @@ module Kitchen
60
57
  # Will try to autodetect by searching for `Policyfile.rb` if not set.
61
58
  # If set, will error if the file doesn't exist.
62
59
  default_config :policyfile_path, nil
63
- # Will try to autodetect by searching for `Berksfile` if not set.
64
- # If set, will error if the file doesn't exist.
65
- default_config :berksfile_path, nil
66
60
  # If set to true (which is the default from `chef generate`), try to update
67
61
  # backend cookbook downloader on every kitchen run.
68
62
  default_config :always_update_cookbooks, false
@@ -249,43 +243,6 @@ module Kitchen
249
243
  end
250
244
  end
251
245
 
252
- # gives us the product version from either require_chef_omnibus or product_version
253
- # If the non-default (true) value of require_chef_omnibus is present use that
254
- # otherwise use config[:product_version] which defaults to :latest and is the actual
255
- # default for chef provisioners
256
- #
257
- # @return [String,Symbol,NilClass] version or nil if not applicable
258
- def product_version
259
- case config[:require_chef_omnibus]
260
- when FalseClass
261
- nil
262
- when TrueClass
263
- config[:product_version]
264
- else
265
- config[:require_chef_omnibus]
266
- end
267
- end
268
-
269
- # (see Base#check_license)
270
- def check_license
271
- name = config[:product_name] || "chef"
272
- version = product_version
273
- debug("Checking if we need to prompt for license acceptance on product: #{name} version: #{version}.")
274
-
275
- acceptor = LicenseAcceptance::Acceptor.new(logger: Kitchen.logger, provided: config[:chef_license])
276
- if acceptor.license_required?(name, version)
277
- debug("License acceptance required for #{name} version: #{version}. Prompting")
278
- license_id = acceptor.id_from_mixlib(name)
279
- begin
280
- acceptor.check_and_persist(license_id, version.to_s)
281
- rescue LicenseAcceptance::LicenseNotAcceptedError => e
282
- error("Cannot converge without accepting the #{e.product.pretty_name} License. Set it in your kitchen.yml or using the CHEF_LICENSE environment variable")
283
- raise
284
- end
285
- config[:chef_license] ||= acceptor.acceptance_value
286
- end
287
- end
288
-
289
246
  # (see Base#create_sandbox)
290
247
  def create_sandbox
291
248
  super
@@ -358,22 +315,14 @@ module Kitchen
358
315
  # @api private
359
316
  def policyfile
360
317
  policyfile_basename = config[:policyfile_path] || config[:policyfile] || "Policyfile.rb"
361
- File.expand_path(policyfile_basename, config[:kitchen_root])
318
+ File.join(config[:kitchen_root], policyfile_basename)
362
319
  end
363
320
 
364
321
  # @return [String] an absolute path to a Berksfile, relative to the
365
322
  # kitchen root
366
323
  # @api private
367
324
  def berksfile
368
- berksfile_basename = config[:berksfile_path] || config[:berksfile] || "Berksfile"
369
- File.expand_path(berksfile_basename, config[:kitchen_root])
370
- end
371
-
372
- # @return [String] an absolute path to a Cheffile, relative to the
373
- # kitchen root
374
- # @api private
375
- def cheffile
376
- File.join(config[:kitchen_root], "Cheffile")
325
+ File.join(config[:kitchen_root], "Berksfile")
377
326
  end
378
327
 
379
328
  # Generates a Hash with default values for a solo.rb or client.rb Chef
@@ -384,7 +333,7 @@ module Kitchen
384
333
  def default_config_rb # rubocop:disable Metrics/MethodLength
385
334
  root = config[:root_path].gsub("$env:TEMP", "\#{ENV['TEMP']\}")
386
335
 
387
- config_rb = {
336
+ {
388
337
  node_name: instance.name,
389
338
  checksum_path: remote_path_join(root, "checksums"),
390
339
  file_cache_path: remote_path_join(root, "cache"),
@@ -407,8 +356,6 @@ module Kitchen
407
356
  ),
408
357
  treat_deprecation_warnings_as_errors: config[:deprecations_as_errors],
409
358
  }
410
- config_rb[:chef_license] = config[:chef_license] unless config[:chef_license].nil?
411
- config_rb
412
359
  end
413
360
 
414
361
  # Generates a rendered client.rb/solo.rb/knife.rb formatted file as a
@@ -477,9 +424,6 @@ module Kitchen
477
424
  elsif File.exist?(berksfile)
478
425
  debug("Berksfile found at #{berksfile}, using Berkshelf to resolve cookbook dependencies")
479
426
  Chef::Berkshelf.load!(logger: logger)
480
- elsif File.exist?(cheffile)
481
- debug("Cheffile found at #{cheffile}, loading Librarian-Chef")
482
- Chef::Librarian.load!(logger: logger)
483
427
  end
484
428
  end
485
429
 
@@ -582,18 +526,13 @@ module Kitchen
582
526
  if (config[:policyfile_path] || config[:policyfile]) && !File.exist?(policyfile)
583
527
  raise UserError, "policyfile_path set in config "\
584
528
  "(#{config[:policyfile_path]} could not be found. " \
585
- "Expected to find it at full path #{policyfile}."
586
- end
587
- if config[:berksfile_path] && !File.exist?(berksfile)
588
- raise UserError, "berksfile_path set in config "\
589
- "(#{config[:berksfile_path]} could not be found. " \
590
- "Expected to find it at full path #{berksfile}."
529
+ "Expected to find it at full path #{policyfile} " \
591
530
  end
592
531
  if File.exist?(policyfile) && !supports_policyfile?
593
532
  raise UserError, "policyfile detected, but provisioner " \
594
533
  "#{self.class.name} doesn't support Policyfiles. " \
595
534
  "Either use a different provisioner, or delete/rename " \
596
- "#{policyfile}."
535
+ "#{policyfile}"
597
536
  end
598
537
  end
599
538
 
@@ -47,24 +47,8 @@ module Kitchen
47
47
  prepare_config_rb
48
48
  end
49
49
 
50
- def modern?
51
- version = config[:require_chef_omnibus]
52
-
53
- case version
54
- when nil, false, true, 11, "11", "latest"
55
- true
56
- else
57
- if Gem::Version.correct?(version)
58
- Gem::Version.new(version) >= Gem::Version.new("11.0") ? true : false
59
- else
60
- true
61
- end
62
- end
63
- end
64
-
65
50
  # (see Base#run_command)
66
51
  def run_command
67
- config[:log_level] = "info" if !modern? && config[:log_level] == "auto"
68
52
  cmd = sudo(config[:chef_solo_path]).dup
69
53
  .tap { |str| str.insert(0, "& ") if powershell_shell? }
70
54
 
@@ -81,13 +65,14 @@ module Kitchen
81
65
  args = [
82
66
  "--config #{remote_path_join(config[:root_path], solo_rb_filename)}",
83
67
  "--log_level #{config[:log_level]}",
68
+ "--force-formatter",
84
69
  "--no-color",
85
70
  "--json-attributes #{remote_path_join(config[:root_path], 'dna.json')}",
86
71
  ]
87
- args << " --force-formatter" if modern?
88
72
  args << "--logfile #{config[:log_file]}" if config[:log_file]
89
73
  args << "--profile-ruby" if config[:profile_ruby]
90
74
  args << "--legacy-mode" if config[:legacy_mode]
75
+
91
76
  args
92
77
  end
93
78
  end
@@ -48,28 +48,12 @@ module Kitchen
48
48
  # (see Base#create_sandbox)
49
49
  def create_sandbox
50
50
  super
51
- prepare_chef_client_zero_rb
52
51
  prepare_validation_pem
53
52
  prepare_config_rb
54
53
  end
55
54
 
56
- # (see Base#prepare_command)
57
- def prepare_command
58
- return if modern?
59
-
60
- gem_bin = remote_path_join(config[:ruby_bindir], "gem")
61
- .tap { |path| path.concat(".bat") if windows_os? }
62
- vars = [
63
- chef_client_zero_env,
64
- shell_var("gem", sudo(gem_bin)),
65
- ].join("\n").concat("\n")
66
-
67
- prefix_command(shell_code_from_file(vars, "chef_zero_prepare_command_legacy"))
68
- end
69
-
70
- # (see Base#run_command)
71
55
  def run_command
72
- cmd = modern? ? local_mode_command : shim_command
56
+ cmd = "#{sudo(config[:chef_client_path])} --local-mode".tap { |str| str.insert(0, "& ") if powershell_shell? }
73
57
 
74
58
  chef_cmd(cmd)
75
59
  end
@@ -88,9 +72,8 @@ module Kitchen
88
72
  args << "--json-attributes #{json}"
89
73
  end
90
74
  args << "--logfile #{config[:log_file]}" if config[:log_file]
91
- return unless modern?
92
75
 
93
- # these flags are modern/chef-client local most only and will not work
76
+ # these flags are chef-client local mode only and will not work
94
77
  # on older versions of chef-client
95
78
  if config[:chef_zero_host]
96
79
  args << "--chef-zero-host #{config[:chef_zero_host]}"
@@ -137,60 +120,6 @@ module Kitchen
137
120
  ].join("\n").concat("\n")
138
121
  end
139
122
 
140
- # Returns the command that will run chef client in local mode (a.k.a.
141
- # chef zero mode).
142
- #
143
- # @return [String] the command string
144
- # @api private
145
- def local_mode_command
146
- "#{sudo(config[:chef_client_path])} --local-mode"
147
- .tap { |str| str.insert(0, "& ") if powershell_shell? }
148
- end
149
-
150
- # Determines whether or not local mode (a.k.a chef zero mode) is
151
- # supported in the version of Chef as determined by inspecting the
152
- # require_chef_omnibus config variable.
153
- #
154
- # The only way this method returns false is if require_chef_omnibus has
155
- # an explicit version set to less than 11.8.0, when chef zero mode was
156
- # introduced. Otherwise a modern Chef installation is assumed.
157
- #
158
- # @return [true,false] whether or not the desired version of Chef
159
- # supports local mode
160
- # @api private
161
- def modern?
162
- version = config[:require_chef_omnibus]
163
-
164
- case version
165
- when nil, false, true, 11, "11", "latest"
166
- true
167
- else
168
- if Gem::Version.correct?(version)
169
- Gem::Version.new(version) >= Gem::Version.new("11.8.0") ? true : false
170
- else
171
- # Build versions of chef, for example
172
- # 12.5.0-current.0+20150721082808.git.14.c91b337-1
173
- true
174
- end
175
- end
176
- end
177
-
178
- # Writes a chef-client local-mode shim script to the sandbox directory
179
- # only if the desired version of Chef is old enough. The version of Chef
180
- # is determined using the `config[:require_chef_omnibus]` value.
181
- #
182
- # @api private
183
- def prepare_chef_client_zero_rb
184
- return if modern?
185
-
186
- info("Preparing chef-client-zero.rb")
187
- debug("Using a vendored chef-client-zero.rb")
188
-
189
- source = File.join(File.dirname(__FILE__),
190
- %w{.. .. .. support chef-client-zero.rb})
191
- FileUtils.cp(source, File.join(sandbox_path, "chef-client-zero.rb"))
192
- end
193
-
194
123
  # Writes a fake (but valid) validation.pem into the sandbox directory.
195
124
  #
196
125
  # @api private
@@ -232,7 +232,7 @@ module Kitchen
232
232
  Errno::EACCES, Errno::EALREADY, Errno::EADDRINUSE, Errno::ECONNREFUSED, Errno::ETIMEDOUT,
233
233
  Errno::ECONNRESET, Errno::ENETUNREACH, Errno::EHOSTUNREACH, Errno::EPIPE,
234
234
  Net::SSH::Disconnect, Net::SSH::AuthenticationFailed, Net::SSH::ConnectionTimeout,
235
- Net::SSH::Proxy::ConnectError, Timeout::Error
235
+ Timeout::Error
236
236
  ].freeze
237
237
 
238
238
  # @return [Integer] cap on number of parallel ssh sessions we can use
@@ -498,9 +498,9 @@ module Kitchen
498
498
  opts[:forward_agent] = data[:forward_agent] if data.key?(:forward_agent)
499
499
  opts[:verbose] = data[:verbose].to_sym if data.key?(:verbose)
500
500
 
501
- # disable host key verification. The hash key to use
502
- # depends on the version of net-ssh in use.
503
- opts[verify_host_key_option] = false
501
+ # disable host key verification. The hash key and value to use
502
+ # depend on the version of net-ssh in use
503
+ opts[verify_host_key_option] = verify_host_key_value
504
504
 
505
505
  opts
506
506
  end
@@ -524,6 +524,18 @@ module Kitchen
524
524
  current_net_ssh >= new_option_version ? :verify_host_key : :paranoid
525
525
  end
526
526
 
527
+ #
528
+ # Returns the correct host-key-verification option value to use depending
529
+ # on what version of net-ssh is in use. In net-ssh <= 5, the supported
530
+ # parameter is false but in 5.0, it became `:never`
531
+ #
532
+ def verify_host_key_value
533
+ current_net_ssh = Net::SSH::Version::CURRENT
534
+ new_option_version = Net::SSH::Version[5, 0, 0]
535
+
536
+ current_net_ssh >= new_option_version ? :never : false
537
+ end
538
+
527
539
  # Creates a new SSH Connection instance and save it for potential future
528
540
  # reuse.
529
541
  #
@@ -182,7 +182,7 @@ module Kitchen
182
182
  # to be under /tmp/verifier
183
183
  args = gem
184
184
  args += " --version #{version}" if version
185
- args += " --no-document --no-format-executable -n #{gem_bin}"
185
+ args += " --no-rdoc --no-ri --no-format-executable -n #{gem_bin}"
186
186
  args += " --no-user-install"
187
187
  args
188
188
  end
@@ -17,5 +17,5 @@
17
17
  # limitations under the License.
18
18
 
19
19
  module Kitchen
20
- VERSION = "1.25.0".freeze
20
+ VERSION = "2.0.0".freeze
21
21
  end
data/test-kitchen.gemspec CHANGED
@@ -24,18 +24,14 @@ Gem::Specification.new do |gem|
24
24
  gem.required_ruby_version = ">= 2.3"
25
25
 
26
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", "< 5.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
29
  gem.add_dependency "net-ssh-gateway", ">= 1.2", "< 3.0" # pinning until we can confirm 3+ works
30
30
  gem.add_dependency "thor", "~> 0.19"
31
31
  gem.add_dependency "mixlib-install", "~> 3.6"
32
- gem.add_dependency "winrm", "~> 2.0"
33
- gem.add_dependency "winrm-elevated", "~> 1.0"
34
- gem.add_dependency "winrm-fs", "~> 1.1"
35
-
36
- # Required to run the Chef provisioner local license check for remote systems
37
- # TK is not under Chef EULA
38
- gem.add_dependency "license-acceptance", "~> 1.0", ">= 1.0.11"
32
+ gem.add_dependency "winrm", "~> 2.0"
33
+ gem.add_dependency "winrm-elevated", "~> 1.0"
34
+ gem.add_dependency "winrm-fs", "~> 1.1"
39
35
 
40
36
  gem.add_development_dependency "rb-readline"
41
37
  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: 1.25.0
4
+ version: 2.0.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-05-31 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '2.9'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '5.0'
62
+ version: '6.0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '2.9'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: '5.0'
72
+ version: '6.0'
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: net-ssh-gateway
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -160,26 +160,6 @@ dependencies:
160
160
  - - "~>"
161
161
  - !ruby/object:Gem::Version
162
162
  version: '1.1'
163
- - !ruby/object:Gem::Dependency
164
- name: license-acceptance
165
- requirement: !ruby/object:Gem::Requirement
166
- requirements:
167
- - - "~>"
168
- - !ruby/object:Gem::Version
169
- version: '1.0'
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- version: 1.0.11
173
- type: :runtime
174
- prerelease: false
175
- version_requirements: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '1.0'
180
- - - ">="
181
- - !ruby/object:Gem::Version
182
- version: 1.0.11
183
163
  - !ruby/object:Gem::Dependency
184
164
  name: rb-readline
185
165
  requirement: !ruby/object:Gem::Requirement
@@ -381,7 +361,6 @@ files:
381
361
  - lib/kitchen/provisioner/base.rb
382
362
  - lib/kitchen/provisioner/chef/berkshelf.rb
383
363
  - lib/kitchen/provisioner/chef/common_sandbox.rb
384
- - lib/kitchen/provisioner/chef/librarian.rb
385
364
  - lib/kitchen/provisioner/chef/policyfile.rb
386
365
  - lib/kitchen/provisioner/chef_apply.rb
387
366
  - lib/kitchen/provisioner/chef_base.rb
@@ -412,13 +391,10 @@ files:
412
391
  - support/busser_install_command.ps1
413
392
  - support/busser_install_command.sh
414
393
  - support/chef-client-fail-if-update-handler.rb
415
- - support/chef-client-zero.rb
416
394
  - support/chef_base_init_command.ps1
417
395
  - support/chef_base_init_command.sh
418
396
  - support/chef_base_install_command.ps1
419
397
  - support/chef_base_install_command.sh
420
- - support/chef_zero_prepare_command_legacy.ps1
421
- - support/chef_zero_prepare_command_legacy.sh
422
398
  - support/download_helpers.sh
423
399
  - support/dummy-validation.pem
424
400
  - templates/driver/CHANGELOG.md.erb
@@ -1,112 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
- #
5
- # Copyright (C) 2013, Fletcher Nichol
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require "kitchen/errors"
20
- require "kitchen/logging"
21
-
22
- module Kitchen
23
- module Provisioner
24
- module Chef
25
- # Chef cookbook resolver that uses Librarian-Chef and a Cheffile to
26
- # calculate dependencies.
27
- #
28
- # @author Fletcher Nichol <fnichol@nichol.ca>
29
- class Librarian
30
- include Logging
31
-
32
- # Creates a new cookbook resolver.
33
- #
34
- # @param cheffile [String] path to a Cheffile
35
- # @param path [String] path in which to vendor the resulting
36
- # cookbooks
37
- # @param logger [Kitchen::Logger] a logger to use for output, defaults
38
- # to `Kitchen.logger`
39
- def initialize(cheffile, path, logger: Kitchen.logger)
40
- @cheffile = cheffile
41
- @path = path
42
- @logger = logger
43
- end
44
-
45
- # Loads the library code required to use the resolver.
46
- #
47
- # @param logger [Kitchen::Logger] a logger to use for output, defaults
48
- # to `Kitchen.logger`
49
- def self.load!(logger: Kitchen.logger)
50
- load_librarian!(logger)
51
- end
52
-
53
- # Performs the cookbook resolution and vendors the resulting cookbooks
54
- # in the desired path.
55
- def resolve
56
- version = ::Librarian::Chef::VERSION
57
- info("Resolving cookbook dependencies with Librarian-Chef #{version}...")
58
- debug("Using Cheffile from #{cheffile}")
59
-
60
- env = ::Librarian::Chef::Environment.new(
61
- project_path: File.dirname(cheffile))
62
- env.config_db.local["path"] = path
63
- ::Librarian::Action::Resolve.new(env).run
64
- ::Librarian::Action::Install.new(env).run
65
- end
66
-
67
- private
68
-
69
- # @return [String] path to a Cheffile
70
- # @api private
71
- attr_reader :cheffile
72
-
73
- # @return [String] path in which to vendor the resulting cookbooks
74
- # @api private
75
- attr_reader :path
76
-
77
- # @return [Kitchen::Logger] a logger to use for output
78
- # @api private
79
- attr_reader :logger
80
-
81
- class << self
82
- private
83
-
84
- # Load the Librarian-specific libary code.
85
- #
86
- # @param logger [Kitchen::Logger] the logger to use
87
- # @raise [UserError] if the library couldn't be loaded
88
- # @api private
89
- def load_librarian!(logger)
90
- first_load = require "librarian/chef/environment"
91
- require "librarian/action/resolve"
92
- require "librarian/action/install"
93
-
94
- version = ::Librarian::Chef::VERSION
95
- if first_load
96
- logger.debug("Librarian-Chef #{version} library loaded")
97
- else
98
- logger.debug("Librarian-Chef #{version} previously loaded")
99
- end
100
- rescue LoadError => e
101
- logger.fatal("The `librarian-chef' gem is missing and must be installed" \
102
- " or cannot be properly activated. Run" \
103
- " `gem install librarian-chef` or add the following to your" \
104
- " Gemfile if you are using Bundler: `gem 'librarian-chef'`.")
105
- raise UserError,
106
- "Could not load or activate Librarian-Chef (#{e.message})"
107
- end
108
- end
109
- end
110
- end
111
- end
112
- end
@@ -1,76 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- encoding: utf-8 -*-
3
- #
4
- # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
5
- #
6
- # Copyright (C) 2013, Fletcher Nichol
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
-
20
- require "rubygems"
21
- require "chef/config"
22
- require "chef_zero/server"
23
- require "chef/chef_fs/chef_fs_data_store"
24
- require "chef/chef_fs/config"
25
- require "English"
26
- require "fileutils"
27
-
28
- # Bust out of our self-imposed sandbox before running chef-client so
29
- # gems installed via gem_package land in Chef's GEM_HOME.
30
- #
31
- # https://github.com/chef/test-kitchen/issues/240
32
- #
33
- ENV["GEM_HOME"] = ENV["GEM_PATH"] = ENV["GEM_CACHE"] = nil
34
-
35
- class ChefClientZero
36
- def self.start
37
- new.run
38
- end
39
-
40
- def run
41
- create_chef_zero_server
42
- run_chef_client
43
- end
44
-
45
- private
46
-
47
- def create_chef_zero_server
48
- Chef::Config.chef_repo_path = Chef::Config.find_chef_repo_path(repo_path)
49
-
50
- chef_fs = Chef::ChefFS::Config.new.local_fs
51
- chef_fs.write_pretty_json = true
52
-
53
- @server = ChefZero::Server.new(
54
- generate_real_keys: false,
55
- data_store: Chef::ChefFS::ChefFSDataStore.new(chef_fs)
56
- )
57
- puts "-----> Starting Chef Zero server in #{chef_fs.fs_description}"
58
- @server.start_background
59
-
60
- at_exit do
61
- puts "-----> Shutting down Chef Zero server"
62
- @server.stop
63
- end
64
- end
65
-
66
- def repo_path
67
- ENV.fetch("CHEF_REPO_PATH", Dir.pwd)
68
- end
69
-
70
- def run_chef_client
71
- system("chef-client", *ARGV)
72
- raise if $CHILD_STATUS != 0
73
- end
74
- end
75
-
76
- ChefClientZero.start
@@ -1,9 +0,0 @@
1
- # we are installing the first version of chef that bundled chef-zero in order
2
- # to get chef-zero and Chef::ChefFS only. The version of Chef that gets run
3
- # will be the installed omnibus package. Yep, this is funky :)
4
-
5
- if ((& "$gem" list chef-zero -i) -ne "true") {
6
- Write-Host ">>>>>> Attempting to use chef-zero with old version of Chef`n"
7
- Write-Host "-----> Installing chef zero dependencies`n"
8
- & "$gem" install chef --version 11.8.0 --no-ri --no-rdoc --conservative
9
- }
@@ -1,10 +0,0 @@
1
- # we are installing the first version of chef that bundled chef-zero in order
2
- # to get chef-zero and Chef::ChefFS only. The version of Chef that gets run
3
- # will be the installed omnibus package. Yep, this is funky :)
4
-
5
- $gem list chef-zero -i 2>&1 >/dev/null
6
- if test $? -ne 0 ; then
7
- echo ">>>>>> Attempting to use chef-zero with old version of Chef"
8
- echo "-----> Installing chef zero dependencies"
9
- $gem install chef --version 11.8.0 --no-ri --no-rdoc --conservative
10
- fi