test-kitchen 1.14.1 → 1.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +1 -1
  3. data/CHANGELOG.md +7 -0
  4. data/Gemfile +1 -1
  5. data/Guardfile +5 -5
  6. data/Rakefile +5 -5
  7. data/bin/kitchen +1 -1
  8. data/features/step_definitions/gem_steps.rb +6 -6
  9. data/features/support/env.rb +6 -7
  10. data/lib/kitchen.rb +5 -7
  11. data/lib/kitchen/base64_stream.rb +2 -8
  12. data/lib/kitchen/cli.rb +76 -80
  13. data/lib/kitchen/collection.rb +0 -2
  14. data/lib/kitchen/color.rb +7 -9
  15. data/lib/kitchen/command.rb +0 -4
  16. data/lib/kitchen/command/action.rb +0 -3
  17. data/lib/kitchen/command/console.rb +4 -7
  18. data/lib/kitchen/command/diagnose.rb +7 -14
  19. data/lib/kitchen/command/driver_discover.rb +1 -4
  20. data/lib/kitchen/command/exec.rb +0 -3
  21. data/lib/kitchen/command/list.rb +9 -12
  22. data/lib/kitchen/command/login.rb +0 -3
  23. data/lib/kitchen/command/package.rb +0 -3
  24. data/lib/kitchen/command/sink.rb +6 -9
  25. data/lib/kitchen/command/test.rb +1 -4
  26. data/lib/kitchen/config.rb +25 -27
  27. data/lib/kitchen/configurable.rb +26 -31
  28. data/lib/kitchen/data_munger.rb +34 -36
  29. data/lib/kitchen/diagnostic.rb +5 -7
  30. data/lib/kitchen/driver.rb +3 -5
  31. data/lib/kitchen/driver/base.rb +0 -3
  32. data/lib/kitchen/driver/dummy.rb +0 -3
  33. data/lib/kitchen/driver/proxy.rb +0 -3
  34. data/lib/kitchen/driver/ssh_base.rb +13 -16
  35. data/lib/kitchen/errors.rb +11 -16
  36. data/lib/kitchen/generator/driver_create.rb +18 -21
  37. data/lib/kitchen/generator/init.rb +21 -26
  38. data/lib/kitchen/instance.rb +19 -23
  39. data/lib/kitchen/lazy_hash.rb +1 -2
  40. data/lib/kitchen/loader/yaml.rb +22 -25
  41. data/lib/kitchen/logger.rb +9 -14
  42. data/lib/kitchen/logging.rb +0 -3
  43. data/lib/kitchen/login_command.rb +0 -2
  44. data/lib/kitchen/metadata_chopper.rb +0 -2
  45. data/lib/kitchen/platform.rb +1 -3
  46. data/lib/kitchen/provisioner.rb +3 -5
  47. data/lib/kitchen/provisioner/base.rb +2 -5
  48. data/lib/kitchen/provisioner/chef/berkshelf.rb +1 -5
  49. data/lib/kitchen/provisioner/chef/common_sandbox.rb +24 -29
  50. data/lib/kitchen/provisioner/chef/librarian.rb +2 -6
  51. data/lib/kitchen/provisioner/chef/policyfile.rb +4 -8
  52. data/lib/kitchen/provisioner/chef_apply.rb +14 -17
  53. data/lib/kitchen/provisioner/chef_base.rb +43 -46
  54. data/lib/kitchen/provisioner/chef_solo.rb +10 -13
  55. data/lib/kitchen/provisioner/chef_zero.rb +22 -29
  56. data/lib/kitchen/provisioner/dummy.rb +0 -3
  57. data/lib/kitchen/provisioner/shell.rb +6 -9
  58. data/lib/kitchen/rake_tasks.rb +4 -6
  59. data/lib/kitchen/shell_out.rb +3 -5
  60. data/lib/kitchen/ssh.rb +16 -22
  61. data/lib/kitchen/state_file.rb +3 -5
  62. data/lib/kitchen/suite.rb +0 -2
  63. data/lib/kitchen/thor_tasks.rb +2 -4
  64. data/lib/kitchen/transport.rb +3 -5
  65. data/lib/kitchen/transport/base.rb +1 -7
  66. data/lib/kitchen/transport/dummy.rb +0 -4
  67. data/lib/kitchen/transport/ssh.rb +41 -47
  68. data/lib/kitchen/transport/winrm.rb +41 -40
  69. data/lib/kitchen/util.rb +1 -3
  70. data/lib/kitchen/verifier.rb +3 -5
  71. data/lib/kitchen/verifier/base.rb +2 -5
  72. data/lib/kitchen/verifier/busser.rb +24 -24
  73. data/lib/kitchen/verifier/dummy.rb +0 -3
  74. data/lib/kitchen/verifier/shell.rb +1 -3
  75. data/lib/kitchen/version.rb +1 -1
  76. data/lib/vendor/hash_recursive_merge.rb +0 -2
  77. data/spec/kitchen/base64_stream_spec.rb +3 -6
  78. data/spec/kitchen/cli_spec.rb +0 -2
  79. data/spec/kitchen/collection_spec.rb +4 -8
  80. data/spec/kitchen/color_spec.rb +0 -3
  81. data/spec/kitchen/config_spec.rb +91 -106
  82. data/spec/kitchen/configurable_spec.rb +44 -76
  83. data/spec/kitchen/data_munger_spec.rb +1178 -1247
  84. data/spec/kitchen/diagnostic_spec.rb +37 -38
  85. data/spec/kitchen/driver/base_spec.rb +7 -14
  86. data/spec/kitchen/driver/dummy_spec.rb +1 -7
  87. data/spec/kitchen/driver/proxy_spec.rb +2 -7
  88. data/spec/kitchen/driver/ssh_base_spec.rb +128 -149
  89. data/spec/kitchen/driver_spec.rb +7 -13
  90. data/spec/kitchen/errors_spec.rb +50 -60
  91. data/spec/kitchen/instance_spec.rb +217 -294
  92. data/spec/kitchen/lazy_hash_spec.rb +14 -18
  93. data/spec/kitchen/loader/yaml_spec.rb +201 -227
  94. data/spec/kitchen/logger_spec.rb +7 -15
  95. data/spec/kitchen/logging_spec.rb +1 -4
  96. data/spec/kitchen/login_command_spec.rb +3 -4
  97. data/spec/kitchen/metadata_chopper_spec.rb +0 -3
  98. data/spec/kitchen/platform_spec.rb +31 -32
  99. data/spec/kitchen/provisioner/base_spec.rb +22 -41
  100. data/spec/kitchen/provisioner/chef/policyfile_spec.rb +15 -15
  101. data/spec/kitchen/provisioner/chef_apply_spec.rb +8 -13
  102. data/spec/kitchen/provisioner/chef_base_spec.rb +150 -182
  103. data/spec/kitchen/provisioner/chef_solo_spec.rb +58 -72
  104. data/spec/kitchen/provisioner/chef_zero_spec.rb +99 -125
  105. data/spec/kitchen/provisioner/dummy_spec.rb +8 -11
  106. data/spec/kitchen/provisioner/shell_spec.rb +86 -103
  107. data/spec/kitchen/provisioner_spec.rb +5 -11
  108. data/spec/kitchen/shell_out_spec.rb +15 -19
  109. data/spec/kitchen/ssh_spec.rb +16 -35
  110. data/spec/kitchen/state_file_spec.rb +6 -11
  111. data/spec/kitchen/suite_spec.rb +5 -6
  112. data/spec/kitchen/transport/base_spec.rb +6 -14
  113. data/spec/kitchen/transport/ssh_spec.rb +39 -64
  114. data/spec/kitchen/transport/winrm_spec.rb +99 -127
  115. data/spec/kitchen/transport_spec.rb +7 -13
  116. data/spec/kitchen/util_spec.rb +17 -26
  117. data/spec/kitchen/verifier/base_spec.rb +24 -40
  118. data/spec/kitchen/verifier/busser_spec.rb +38 -68
  119. data/spec/kitchen/verifier/dummy_spec.rb +8 -11
  120. data/spec/kitchen/verifier/shell_spec.rb +14 -17
  121. data/spec/kitchen/verifier_spec.rb +7 -13
  122. data/spec/kitchen_spec.rb +4 -6
  123. data/spec/spec_helper.rb +1 -1
  124. data/spec/support/powershell_max_size_spec.rb +1 -2
  125. data/support/chef-client-zero.rb +3 -4
  126. data/test-kitchen.gemspec +4 -6
  127. metadata +9 -9
@@ -21,14 +21,12 @@ require "thor/util"
21
21
  require "kitchen/lazy_hash"
22
22
 
23
23
  module Kitchen
24
-
25
24
  # A mixin for providing configuration-related behavior such as default
26
25
  # config (static, computed, inherited), required config, local path
27
26
  # expansion, etc.
28
27
  #
29
28
  # @author Fletcher Nichol <fnichol@nichol.ca>
30
29
  module Configurable
31
-
32
30
  def self.included(base)
33
31
  base.extend(ClassMethods)
34
32
  end
@@ -46,9 +44,7 @@ module Kitchen
46
44
  # @return [self] itself, for use in chaining
47
45
  # @raise [ClientError] if instance parameter is nil
48
46
  def finalize_config!(instance)
49
- if instance.nil?
50
- raise ClientError, "Instance must be provided to #{self}"
51
- end
47
+ raise ClientError, "Instance must be provided to #{self}" if instance.nil?
52
48
 
53
49
  @instance = instance
54
50
  expand_paths!
@@ -102,7 +98,7 @@ module Kitchen
102
98
  [
103
99
  File.join(base, instance.suite.name, path),
104
100
  File.join(base, path),
105
- File.join(Dir.pwd, path)
101
+ File.join(Dir.pwd, path),
106
102
  ].find do |candidate|
107
103
  type == :directory ? File.directory?(candidate) : File.file?(candidate)
108
104
  end
@@ -119,7 +115,7 @@ module Kitchen
119
115
  #
120
116
  # @return [Hash] a diagnostic hash
121
117
  def diagnose
122
- result = Hash.new
118
+ result = {}
123
119
  config_keys.sort.each { |k| result[k] = config[k] }
124
120
  result
125
121
  end
@@ -130,7 +126,7 @@ module Kitchen
130
126
  #
131
127
  # @return [Hash] a diagnostic hash
132
128
  def diagnose_plugin
133
- result = Hash.new
129
+ result = {}
134
130
  result[:name] = name
135
131
  result.merge!(self.class.diagnose)
136
132
  result
@@ -153,7 +149,7 @@ module Kitchen
153
149
  # @return [String] joined path for instance's os_type
154
150
  def remote_path_join(*parts)
155
151
  path = File.join(*parts)
156
- windows_os? ? path.gsub("/", "\\") : path.gsub("\\", "/")
152
+ windows_os? ? path.tr("/", '\\') : path.tr('\\', "/")
157
153
  end
158
154
 
159
155
  # @return [TrueClass,FalseClass] true if `:os_type` is `"unix"` (or
@@ -210,10 +206,10 @@ module Kitchen
210
206
  next if !should_expand || config[key].nil? || config[key] == false
211
207
 
212
208
  config[key] = if config[key].is_a?(Array)
213
- config[key].map { |path| File.expand_path(path, root_path) }
214
- else
215
- File.expand_path(config[key], root_path)
216
- end
209
+ config[key].map { |path| File.expand_path(path, root_path) }
210
+ else
211
+ File.expand_path(config[key], root_path)
212
+ end
217
213
  end
218
214
  end
219
215
 
@@ -256,7 +252,7 @@ module Kitchen
256
252
  [
257
253
  "$env:PATH = try {",
258
254
  "[System.Environment]::GetEnvironmentVariable('PATH','Machine')",
259
- "} catch { $env:PATH }\n\n"
255
+ "} catch { $env:PATH }\n\n",
260
256
  ].join("\n")
261
257
  end
262
258
 
@@ -329,8 +325,8 @@ module Kitchen
329
325
  if !config.key?(protocol) || config[protocol].nil?
330
326
  export_proxy(set_env, protocol)
331
327
  elsif proxy_config_setting_present?(protocol)
332
- set_env << shell_env_var("#{protocol.downcase}", config[protocol])
333
- set_env << shell_env_var("#{protocol.upcase}", config[protocol])
328
+ set_env << shell_env_var(protocol.downcase.to_s, config[protocol])
329
+ set_env << shell_env_var(protocol.upcase.to_s, config[protocol])
334
330
  end
335
331
  end
336
332
  end
@@ -356,7 +352,7 @@ module Kitchen
356
352
 
357
353
  def proxy_from_environment?
358
354
  proxy_setting_keys.any? do |protocol|
359
- !ENV["#{protocol.downcase}"].nil? || !ENV["#{protocol.upcase}"].nil?
355
+ !ENV[protocol.downcase.to_s].nil? || !ENV[protocol.upcase.to_s].nil?
360
356
  end
361
357
  end
362
358
 
@@ -370,14 +366,13 @@ module Kitchen
370
366
  # @param code [String] the type of proxy to export, one of 'http', 'https' or 'ftp'
371
367
  # @api private
372
368
  def export_proxy(env, type)
373
- env << shell_env_var("#{type}", ENV["#{type}"]) if ENV["#{type}"]
374
- env << shell_env_var("#{type.upcase}", ENV["#{type.upcase}"]) if
375
- ENV["#{type.upcase}"]
369
+ env << shell_env_var(type.to_s, ENV[type.to_s]) if ENV[type.to_s]
370
+ env << shell_env_var(type.upcase.to_s, ENV[type.upcase.to_s]) if
371
+ ENV[type.upcase.to_s]
376
372
  end
377
373
 
378
374
  # Class methods which will be mixed in on inclusion of Configurable module.
379
375
  module ClassMethods
380
-
381
376
  # Sets the loaded version of this plugin, usually corresponding to the
382
377
  # RubyGems version of the plugin's library. If the plugin does not set
383
378
  # this value, then `nil` will be used and reported.
@@ -407,9 +402,9 @@ module Kitchen
407
402
  # @return [Hash] a diagnostic hash
408
403
  def diagnose
409
404
  {
410
- :class => name,
411
- :version => @plugin_version,
412
- :api_version => @api_version
405
+ class: name,
406
+ version: @plugin_version,
407
+ api_version: @api_version,
413
408
  }
414
409
  end
415
410
 
@@ -489,7 +484,7 @@ module Kitchen
489
484
  # @yieldparam value [Object] the current value of the attribute
490
485
  # @yieldparam object [Object] a reference to the instantiated object
491
486
  def required_config(attr, &block)
492
- if !block_given?
487
+ unless block_given?
493
488
  klass = self
494
489
  block = lambda do |_, value, thing|
495
490
  if value.nil? || value.to_s.empty?
@@ -505,7 +500,7 @@ module Kitchen
505
500
  # been merged with any superclass defaults
506
501
  # @api private
507
502
  def defaults
508
- @defaults ||= Hash.new.merge(super_defaults)
503
+ @defaults ||= {}.merge(super_defaults)
509
504
  end
510
505
 
511
506
  # @return [Hash] a hash of defaults from the included class' superclass
@@ -515,7 +510,7 @@ module Kitchen
515
510
  if superclass.respond_to?(:defaults)
516
511
  superclass.defaults
517
512
  else
518
- Hash.new
513
+ {}
519
514
  end
520
515
  end
521
516
 
@@ -524,7 +519,7 @@ module Kitchen
524
519
  # which has been merged with any superclass expanded paths
525
520
  # @api private
526
521
  def expanded_paths
527
- @expanded_paths ||= Hash.new.merge(super_expanded_paths)
522
+ @expanded_paths ||= {}.merge(super_expanded_paths)
528
523
  end
529
524
 
530
525
  # @return [Hash] a hash of expanded paths from the included class'
@@ -534,7 +529,7 @@ module Kitchen
534
529
  if superclass.respond_to?(:expanded_paths)
535
530
  superclass.expanded_paths
536
531
  else
537
- Hash.new
532
+ {}
538
533
  end
539
534
  end
540
535
 
@@ -542,7 +537,7 @@ module Kitchen
542
537
  # which has been merged with any superclass valudations
543
538
  # @api private
544
539
  def validations
545
- @validations ||= Hash.new.merge(super_validations)
540
+ @validations ||= {}.merge(super_validations)
546
541
  end
547
542
 
548
543
  # @return [Hash] a hash of validations from the included class'
@@ -552,7 +547,7 @@ module Kitchen
552
547
  if superclass.respond_to?(:validations)
553
548
  superclass.validations
554
549
  else
555
- Hash.new
550
+ {}
556
551
  end
557
552
  end
558
553
  end
@@ -19,7 +19,6 @@
19
19
  require "vendor/hash_recursive_merge"
20
20
 
21
21
  module Kitchen
22
-
23
22
  # Class to handle recursive merging of configuration between platforms,
24
23
  # suites, and common data.
25
24
  #
@@ -32,7 +31,6 @@ module Kitchen
32
31
  #
33
32
  # @author Fletcher Nichol <fnichol@nichol.ca>
34
33
  class DataMunger
35
-
36
34
  # Constructs a new DataMunger object.
37
35
  #
38
36
  # @param data [Hash] the incoming user data hash
@@ -135,9 +133,9 @@ module Kitchen
135
133
 
136
134
  def combine_arrays!(root, key, *namespaces)
137
135
  if root.key?(key)
138
- root[key] = namespaces.
139
- map { |namespace| root.fetch(key).fetch(namespace, []) }.flatten.
140
- compact
136
+ root[key] = namespaces
137
+ .map { |namespace| root.fetch(key).fetch(namespace, []) }.flatten
138
+ .compact
141
139
  end
142
140
  end
143
141
 
@@ -219,11 +217,11 @@ module Kitchen
219
217
  def convert_legacy_busser_format_at!(root)
220
218
  if root.key?(:busser)
221
219
  bdata = root.delete(:busser)
222
- bdata = { :version => bdata } if bdata.is_a?(String)
220
+ bdata = { version: bdata } if bdata.is_a?(String)
223
221
  bdata[:name] = "busser" if bdata[:name].nil?
224
222
 
225
- vdata = root.fetch(:verifier, Hash.new)
226
- vdata = { :name => vdata } if vdata.is_a?(String)
223
+ vdata = root.fetch(:verifier, {})
224
+ vdata = { name: vdata } if vdata.is_a?(String)
227
225
  root[:verifier] = bdata.rmerge(vdata)
228
226
  end
229
227
  end
@@ -275,10 +273,10 @@ module Kitchen
275
273
  # @api private
276
274
  def convert_legacy_chef_paths_format!
277
275
  data.fetch(:suites, []).each do |suite|
278
- %w[
276
+ %w{
279
277
  data data_bags encrypted_data_bag_secret_key
280
278
  environments nodes roles
281
- ].each do |key|
279
+ }.each do |key|
282
280
  move_chef_data_to_provisioner_at!(suite, "#{key}_path".to_sym)
283
281
  end
284
282
  end
@@ -364,15 +362,15 @@ module Kitchen
364
362
  # @api private
365
363
  def convert_legacy_driver_format_at!(root)
366
364
  if root.key?(:driver_config)
367
- ddata = root.fetch(:driver, Hash.new)
368
- ddata = { :name => ddata } if ddata.is_a?(String)
365
+ ddata = root.fetch(:driver, {})
366
+ ddata = { name: ddata } if ddata.is_a?(String)
369
367
  root[:driver] = root.delete(:driver_config).rmerge(ddata)
370
368
  end
371
369
 
372
370
  if root.key?(:driver_plugin)
373
- ddata = root.fetch(:driver, Hash.new)
374
- ddata = { :name => ddata } if ddata.is_a?(String)
375
- root[:driver] = { :name => root.delete(:driver_plugin) }.rmerge(ddata)
371
+ ddata = root.fetch(:driver, {})
372
+ ddata = { name: ddata } if ddata.is_a?(String)
373
+ root[:driver] = { name: root.delete(:driver_plugin) }.rmerge(ddata)
376
374
  end
377
375
  end
378
376
 
@@ -485,17 +483,17 @@ module Kitchen
485
483
  # longer are Drivers responsible for this.
486
484
  # @api private
487
485
  def convert_legacy_driver_http_proxy_format_at!(root)
488
- ddata = root.fetch(:driver, Hash.new)
486
+ ddata = root.fetch(:driver, {})
489
487
 
490
488
  [:http_proxy, :https_proxy].each do |key|
491
489
  next unless ddata.is_a?(Hash) && ddata.key?(key)
492
490
 
493
- pdata = root.fetch(:provisioner, Hash.new)
494
- pdata = { :name => pdata } if pdata.is_a?(String)
491
+ pdata = root.fetch(:provisioner, {})
492
+ pdata = { name: pdata } if pdata.is_a?(String)
495
493
  root[:provisioner] = { key => ddata.fetch(key) }.rmerge(pdata)
496
494
 
497
- vdata = root.fetch(:verifier, Hash.new)
498
- vdata = { :name => vdata } if vdata.is_a?(String)
495
+ vdata = root.fetch(:verifier, {})
496
+ vdata = { name: vdata } if vdata.is_a?(String)
499
497
  root[:verifier] = { key => ddata.fetch(key) }.rmerge(vdata)
500
498
  end
501
499
  end
@@ -581,11 +579,11 @@ module Kitchen
581
579
  # @api private
582
580
  def convert_legacy_require_chef_omnibus_format_at!(root)
583
581
  key = :require_chef_omnibus
584
- ddata = root.fetch(:driver, Hash.new)
582
+ ddata = root.fetch(:driver, {})
585
583
 
586
584
  if ddata.is_a?(Hash) && ddata.key?(key)
587
- pdata = root.fetch(:provisioner, Hash.new)
588
- pdata = { :name => pdata } if pdata.is_a?(String)
585
+ pdata = root.fetch(:provisioner, {})
586
+ pdata = { name: pdata } if pdata.is_a?(String)
589
587
  root[:provisioner] =
590
588
  { key => root.fetch(:driver).delete(key) }.rmerge(pdata)
591
589
  end
@@ -699,9 +697,9 @@ module Kitchen
699
697
  # @api private
700
698
  def move_chef_data_to_provisioner_at!(root, key)
701
699
  if root.key?(key)
702
- pdata = root.fetch(:provisioner, Hash.new)
703
- pdata = { :name => pdata } if pdata.is_a?(String)
704
- if !root.fetch(key, nil).nil?
700
+ pdata = root.fetch(:provisioner, {})
701
+ pdata = { name: pdata } if pdata.is_a?(String)
702
+ unless root.fetch(key, nil).nil?
705
703
  root[:provisioner] = pdata.rmerge(key => root.delete(key))
706
704
  end
707
705
  end
@@ -755,8 +753,8 @@ module Kitchen
755
753
  # new Hash otherwise
756
754
  # @api private
757
755
  def normalized_common_data(key, default_key)
758
- cdata = data.fetch(key, Hash.new)
759
- cdata = cdata.nil? ? Hash.new : cdata.dup
756
+ cdata = data.fetch(key, {})
757
+ cdata = cdata.nil? ? {} : cdata.dup
760
758
  cdata = { default_key => cdata } if cdata.is_a?(String)
761
759
  cdata
762
760
  end
@@ -799,7 +797,7 @@ module Kitchen
799
797
  # new Hash otherwise
800
798
  # @api private
801
799
  def normalized_default_data(key, default_key, suite, platform)
802
- ddata = kitchen_config.fetch(:defaults, Hash.new).fetch(key, Hash.new).dup
800
+ ddata = kitchen_config.fetch(:defaults, {}).fetch(key, {}).dup
803
801
  ddata = { default_key => ddata.call(suite, platform) } if ddata.is_a?(Proc)
804
802
  ddata = { default_key => ddata } if ddata.is_a?(String)
805
803
  ddata
@@ -853,8 +851,8 @@ module Kitchen
853
851
  # new Hash otherwise
854
852
  # @api private
855
853
  def normalized_platform_data(key, default_key, platform)
856
- pdata = platform_data_for(platform).fetch(key, Hash.new)
857
- pdata = pdata.nil? ? Hash.new : pdata.dup
854
+ pdata = platform_data_for(platform).fetch(key, {})
855
+ pdata = pdata.nil? ? {} : pdata.dup
858
856
  pdata = { default_key => pdata } if pdata.is_a?(String)
859
857
  namespace_array!(pdata, :run_list, :platform)
860
858
  pdata
@@ -908,8 +906,8 @@ module Kitchen
908
906
  # new Hash otherwise
909
907
  # @api private
910
908
  def normalized_suite_data(key, default_key, suite)
911
- sdata = suite_data_for(suite).fetch(key, Hash.new)
912
- sdata = sdata.nil? ? Hash.new : sdata.dup
909
+ sdata = suite_data_for(suite).fetch(key, {})
910
+ sdata = sdata.nil? ? {} : sdata.dup
913
911
  sdata = { default_key => sdata } if sdata.is_a?(String)
914
912
  namespace_array!(sdata, :run_list, :suite)
915
913
  sdata
@@ -923,7 +921,7 @@ module Kitchen
923
921
  # Hash if not found
924
922
  # @api private
925
923
  def platform_data_for(name)
926
- data.fetch(:platforms, Hash.new).find(-> { Hash.new }) do |platform|
924
+ data.fetch(:platforms, {}).find(-> { Hash.new }) do |platform|
927
925
  platform.fetch(:name, nil) == name
928
926
  end
929
927
  end
@@ -939,7 +937,7 @@ module Kitchen
939
937
  # @param key [Symbol] the key to search for
940
938
  # @api private
941
939
  def set_kitchen_config_at!(root, key)
942
- kdata = data.fetch(:kitchen, Hash.new)
940
+ kdata = data.fetch(:kitchen, {})
943
941
 
944
942
  root.delete(key) if root.key?(key)
945
943
  root[key] = kitchen_config.fetch(key) if kitchen_config.key?(key)
@@ -954,7 +952,7 @@ module Kitchen
954
952
  # Hash if not found
955
953
  # @api private
956
954
  def suite_data_for(name)
957
- data.fetch(:suites, Hash.new).find(-> { Hash.new }) do |suite|
955
+ data.fetch(:suites, {}).find(-> { Hash.new }) do |suite|
958
956
  suite.fetch(:name, nil) == name
959
957
  end
960
958
  end
@@ -20,13 +20,11 @@ require "kitchen/util"
20
20
  require "kitchen/version"
21
21
 
22
22
  module Kitchen
23
-
24
23
  # Combines and compiles diagnostic information about a Test Kitchen
25
24
  # configuration suitable for support and troubleshooting.
26
25
  #
27
26
  # @author Fletcher Nichol <fnichol@nichol.ca>
28
27
  class Diagnostic
29
-
30
28
  # Constructs a new Diagnostic object with an optional loader and optional
31
29
  # instances array.
32
30
  #
@@ -41,7 +39,7 @@ module Kitchen
41
39
  @loader = options.fetch(:loader, nil)
42
40
  @instances = options.fetch(:instances, [])
43
41
  @plugins = options.fetch(:plugins, false)
44
- @result = Hash.new
42
+ @result = {}
45
43
  end
46
44
 
47
45
  # Returns a Hash with stringified keys containing diagnostic information.
@@ -98,12 +96,12 @@ module Kitchen
98
96
  return unless @plugins
99
97
 
100
98
  if error_hash?(instances)
101
- result[:plugins] = { :error => instances[:error] }
99
+ result[:plugins] = { error: instances[:error] }
102
100
  elsif instances.empty?
103
- result[:plugins] = Hash.new
101
+ result[:plugins] = {}
104
102
  else
105
103
  plugins = {
106
- :driver => [], :provisioner => [], :transport => [], :verifier => []
104
+ driver: [], provisioner: [], transport: [], verifier: []
107
105
  }
108
106
  instances.map(&:diagnose_plugins).each do |plugin_hash|
109
107
  plugin_hash.each { |type, plugin| plugins[type] << plugin }
@@ -120,7 +118,7 @@ module Kitchen
120
118
  #
121
119
  # @api private
122
120
  def prepare_instances
123
- result[:instances] = Hash.new
121
+ result[:instances] = {}
124
122
  if error_hash?(instances)
125
123
  result[:instances][:error] = instances[:error]
126
124
  else
@@ -19,13 +19,11 @@
19
19
  require "thor/util"
20
20
 
21
21
  module Kitchen
22
-
23
22
  # A driver is responsible for carrying out the lifecycle activities of an
24
23
  # instance, such as creating and destroying an instance.
25
24
  #
26
25
  # @author Fletcher Nichol <fnichol@nichol.ca>
27
26
  module Driver
28
-
29
27
  # Default driver plugin to use
30
28
  DEFAULT_PLUGIN = "dummy".freeze
31
29
 
@@ -48,9 +46,9 @@ module Kitchen
48
46
  raise
49
47
  rescue LoadError, NameError
50
48
  raise ClientError,
51
- "Could not load the '#{plugin}' driver from the load path." \
52
- " Please ensure that your driver is installed as a gem or included" \
53
- " in your Gemfile if using Bundler."
49
+ "Could not load the '#{plugin}' driver from the load path." \
50
+ " Please ensure that your driver is installed as a gem or included" \
51
+ " in your Gemfile if using Bundler."
54
52
  end
55
53
  end
56
54
  end