test-kitchen 1.19.2 → 1.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +0 -0
  3. data/.github/ISSUE_TEMPLATE.md +0 -0
  4. data/.gitignore +1 -0
  5. data/.kitchen.ci.yml +0 -0
  6. data/.kitchen.dokken.yml +0 -0
  7. data/.kitchen.proxy.yml +0 -0
  8. data/.rubocop.yml +0 -0
  9. data/.travis.yml +0 -0
  10. data/.yardopts +0 -0
  11. data/Berksfile +0 -0
  12. data/CHANGELOG.md +66 -0
  13. data/CONTRIBUTING.md +0 -0
  14. data/ECOSYSTEM.md +0 -0
  15. data/Gemfile +0 -0
  16. data/Gemfile.proxy_tests +0 -0
  17. data/Guardfile +0 -0
  18. data/LICENSE +0 -0
  19. data/MAINTAINERS.md +0 -0
  20. data/README.md +0 -0
  21. data/Rakefile +0 -0
  22. data/appveyor.yml +0 -0
  23. data/features/kitchen_action_commands.feature +0 -0
  24. data/features/kitchen_command.feature +0 -0
  25. data/features/kitchen_console_command.feature +0 -0
  26. data/features/kitchen_defaults.feature +0 -0
  27. data/features/kitchen_diagnose_command.feature +0 -0
  28. data/features/kitchen_help_command.feature +0 -0
  29. data/features/kitchen_init_command.feature +0 -0
  30. data/features/kitchen_list_command.feature +0 -0
  31. data/features/kitchen_login_command.feature +0 -0
  32. data/features/kitchen_sink_command.feature +0 -0
  33. data/features/kitchen_test_command.feature +0 -0
  34. data/features/step_definitions/gem_steps.rb +0 -0
  35. data/features/step_definitions/git_steps.rb +0 -0
  36. data/features/step_definitions/output_steps.rb +0 -0
  37. data/features/support/env.rb +0 -0
  38. data/lib/kitchen.rb +0 -0
  39. data/lib/kitchen/base64_stream.rb +0 -0
  40. data/lib/kitchen/cli.rb +0 -0
  41. data/lib/kitchen/collection.rb +0 -0
  42. data/lib/kitchen/color.rb +0 -0
  43. data/lib/kitchen/command.rb +0 -0
  44. data/lib/kitchen/command/action.rb +0 -0
  45. data/lib/kitchen/command/console.rb +0 -0
  46. data/lib/kitchen/command/diagnose.rb +0 -0
  47. data/lib/kitchen/command/doctor.rb +0 -0
  48. data/lib/kitchen/command/exec.rb +0 -0
  49. data/lib/kitchen/command/list.rb +0 -0
  50. data/lib/kitchen/command/login.rb +0 -0
  51. data/lib/kitchen/command/package.rb +0 -0
  52. data/lib/kitchen/command/sink.rb +0 -0
  53. data/lib/kitchen/command/test.rb +0 -0
  54. data/lib/kitchen/config.rb +0 -0
  55. data/lib/kitchen/configurable.rb +68 -0
  56. data/lib/kitchen/data_munger.rb +0 -0
  57. data/lib/kitchen/diagnostic.rb +0 -0
  58. data/lib/kitchen/driver.rb +0 -0
  59. data/lib/kitchen/driver/base.rb +0 -0
  60. data/lib/kitchen/driver/dummy.rb +0 -0
  61. data/lib/kitchen/driver/exec.rb +0 -0
  62. data/lib/kitchen/driver/proxy.rb +0 -0
  63. data/lib/kitchen/driver/ssh_base.rb +6 -0
  64. data/lib/kitchen/errors.rb +0 -0
  65. data/lib/kitchen/generator/init.rb +0 -0
  66. data/lib/kitchen/instance.rb +0 -0
  67. data/lib/kitchen/lazy_hash.rb +8 -0
  68. data/lib/kitchen/loader/yaml.rb +3 -3
  69. data/lib/kitchen/logger.rb +0 -0
  70. data/lib/kitchen/logging.rb +0 -0
  71. data/lib/kitchen/login_command.rb +0 -0
  72. data/lib/kitchen/metadata_chopper.rb +0 -0
  73. data/lib/kitchen/platform.rb +0 -0
  74. data/lib/kitchen/provisioner.rb +0 -0
  75. data/lib/kitchen/provisioner/base.rb +8 -0
  76. data/lib/kitchen/provisioner/chef/berkshelf.rb +0 -0
  77. data/lib/kitchen/provisioner/chef/common_sandbox.rb +5 -1
  78. data/lib/kitchen/provisioner/chef/librarian.rb +0 -0
  79. data/lib/kitchen/provisioner/chef/policyfile.rb +0 -0
  80. data/lib/kitchen/provisioner/chef_apply.rb +0 -0
  81. data/lib/kitchen/provisioner/chef_base.rb +96 -0
  82. data/lib/kitchen/provisioner/chef_solo.rb +0 -0
  83. data/lib/kitchen/provisioner/chef_zero.rb +0 -0
  84. data/lib/kitchen/provisioner/dummy.rb +0 -0
  85. data/lib/kitchen/provisioner/shell.rb +0 -0
  86. data/lib/kitchen/rake_tasks.rb +0 -0
  87. data/lib/kitchen/shell_out.rb +0 -0
  88. data/lib/kitchen/ssh.rb +0 -0
  89. data/lib/kitchen/state_file.rb +3 -3
  90. data/lib/kitchen/suite.rb +0 -0
  91. data/lib/kitchen/thor_tasks.rb +0 -0
  92. data/lib/kitchen/transport.rb +0 -0
  93. data/lib/kitchen/transport/base.rb +13 -1
  94. data/lib/kitchen/transport/dummy.rb +4 -0
  95. data/lib/kitchen/transport/exec.rb +0 -0
  96. data/lib/kitchen/transport/ssh.rb +71 -9
  97. data/lib/kitchen/transport/winrm.rb +16 -0
  98. data/lib/kitchen/util.rb +0 -0
  99. data/lib/kitchen/verifier.rb +0 -0
  100. data/lib/kitchen/verifier/base.rb +0 -0
  101. data/lib/kitchen/verifier/busser.rb +0 -0
  102. data/lib/kitchen/verifier/dummy.rb +0 -0
  103. data/lib/kitchen/verifier/shell.rb +0 -0
  104. data/lib/kitchen/version.rb +1 -1
  105. data/lib/vendor/hash_recursive_merge.rb +0 -0
  106. data/spec/kitchen/base64_stream_spec.rb +0 -0
  107. data/spec/kitchen/cli_spec.rb +0 -0
  108. data/spec/kitchen/collection_spec.rb +0 -0
  109. data/spec/kitchen/color_spec.rb +0 -0
  110. data/spec/kitchen/config_spec.rb +0 -0
  111. data/spec/kitchen/configurable_spec.rb +0 -0
  112. data/spec/kitchen/data_munger_spec.rb +0 -0
  113. data/spec/kitchen/diagnostic_spec.rb +0 -0
  114. data/spec/kitchen/driver/base_spec.rb +0 -0
  115. data/spec/kitchen/driver/dummy_spec.rb +0 -0
  116. data/spec/kitchen/driver/exec_spec.rb +0 -0
  117. data/spec/kitchen/driver/proxy_spec.rb +0 -0
  118. data/spec/kitchen/driver/ssh_base_spec.rb +42 -1
  119. data/spec/kitchen/driver_spec.rb +0 -0
  120. data/spec/kitchen/errors_spec.rb +0 -0
  121. data/spec/kitchen/instance_spec.rb +0 -0
  122. data/spec/kitchen/lazy_hash_spec.rb +0 -0
  123. data/spec/kitchen/loader/yaml_spec.rb +2 -6
  124. data/spec/kitchen/logger_spec.rb +0 -0
  125. data/spec/kitchen/logging_spec.rb +0 -0
  126. data/spec/kitchen/login_command_spec.rb +0 -0
  127. data/spec/kitchen/metadata_chopper_spec.rb +0 -0
  128. data/spec/kitchen/platform_spec.rb +0 -0
  129. data/spec/kitchen/provisioner/base_spec.rb +25 -0
  130. data/spec/kitchen/provisioner/chef/policyfile_spec.rb +0 -0
  131. data/spec/kitchen/provisioner/chef_apply_spec.rb +0 -0
  132. data/spec/kitchen/provisioner/chef_base_spec.rb +28 -0
  133. data/spec/kitchen/provisioner/chef_solo_spec.rb +0 -0
  134. data/spec/kitchen/provisioner/chef_zero_spec.rb +0 -0
  135. data/spec/kitchen/provisioner/dummy_spec.rb +0 -0
  136. data/spec/kitchen/provisioner/shell_spec.rb +0 -0
  137. data/spec/kitchen/provisioner_spec.rb +0 -0
  138. data/spec/kitchen/shell_out_spec.rb +0 -0
  139. data/spec/kitchen/ssh_spec.rb +0 -0
  140. data/spec/kitchen/state_file_spec.rb +1 -3
  141. data/spec/kitchen/suite_spec.rb +0 -0
  142. data/spec/kitchen/transport/base_spec.rb +17 -0
  143. data/spec/kitchen/transport/exec_spec.rb +0 -0
  144. data/spec/kitchen/transport/ssh_spec.rb +111 -0
  145. data/spec/kitchen/transport/winrm_spec.rb +0 -0
  146. data/spec/kitchen/transport_spec.rb +0 -0
  147. data/spec/kitchen/util_spec.rb +0 -0
  148. data/spec/kitchen/verifier/base_spec.rb +0 -0
  149. data/spec/kitchen/verifier/busser_spec.rb +0 -0
  150. data/spec/kitchen/verifier/dummy_spec.rb +0 -0
  151. data/spec/kitchen/verifier/shell_spec.rb +0 -0
  152. data/spec/kitchen/verifier_spec.rb +0 -0
  153. data/spec/kitchen_spec.rb +0 -0
  154. data/spec/spec_helper.rb +0 -0
  155. data/spec/support/powershell_max_size_spec.rb +0 -0
  156. data/support/busser_install_command.ps1 +0 -0
  157. data/support/busser_install_command.sh +0 -0
  158. data/support/chef-client-fail-if-update-handler.rb +0 -0
  159. data/support/chef_base_init_command.ps1 +0 -0
  160. data/support/chef_base_init_command.sh +0 -0
  161. data/support/chef_base_install_command.ps1 +0 -0
  162. data/support/chef_base_install_command.sh +0 -0
  163. data/support/chef_zero_prepare_command_legacy.ps1 +0 -0
  164. data/support/chef_zero_prepare_command_legacy.sh +0 -0
  165. data/support/download_helpers.sh +0 -0
  166. data/support/dummy-validation.pem +0 -0
  167. data/templates/driver/CHANGELOG.md.erb +0 -0
  168. data/templates/driver/Gemfile.erb +0 -0
  169. data/templates/driver/README.md.erb +0 -0
  170. data/templates/driver/Rakefile.erb +0 -0
  171. data/templates/driver/driver.rb.erb +0 -0
  172. data/templates/driver/gemspec.erb +0 -0
  173. data/templates/driver/gitignore.erb +0 -0
  174. data/templates/driver/license_apachev2.erb +0 -0
  175. data/templates/driver/license_lgplv3.erb +0 -0
  176. data/templates/driver/license_mit.erb +0 -0
  177. data/templates/driver/license_reserved.erb +0 -0
  178. data/templates/driver/tailor.erb +0 -0
  179. data/templates/driver/travis.yml.erb +0 -0
  180. data/templates/driver/version.rb.erb +0 -0
  181. data/templates/init/chefignore.erb +0 -0
  182. data/templates/init/kitchen.yml.erb +0 -0
  183. data/test-kitchen.gemspec +1 -2
  184. data/test/cookbooks/test_cookbook/metadata.rb +0 -0
  185. data/test/cookbooks/test_cookbook/recipes/default.rb +0 -0
  186. data/test/integration/default/default_spec.rb +0 -0
  187. data/testing_windows.md +0 -0
  188. metadata +8 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47da53755bdf92a168665f8d186cee7c6ab0b6aa
4
- data.tar.gz: 5b8c68597cfef026d01c4dceeaeebe5340bfbf4a
3
+ metadata.gz: 3347ab6b20b7e1ec694d6fa3d050694253dcc9b1
4
+ data.tar.gz: dc5c2281fb606f23c941ea86554d51d45a18deb9
5
5
  SHA512:
6
- metadata.gz: 12bb70b314a8f3e12c93b4cb2869c3c20e9c7d4c53a000aed1f077fe0fc8d3f99cdc40b3cc9e833fe2ae5c9bb258b6d75ada2475e483aa894e5e359c63350490
7
- data.tar.gz: d08e43f30e430d1b1e79804dc1ebf9b5020fe805c0b564e5e7229075bf453a749c671df655aed18e583657d2a2e285b5d2aac1a0ba721bfa8eafc9f13253fc24
6
+ metadata.gz: 8fc1efddb69de36cb94b465377edc773f0aa24c133b80133ead971090abb03d92eb747a1e9e739fdb802f5d170ffb18bc486bb2b07ad8d80ba73097548d8a120
7
+ data.tar.gz: ea3ce216891dcde776bef616fed38dce086552d1ea46bfd38278bfe85de2b0a37b58b2ad333a6bd7cf66044c1c8d3e84033ede36b64a6b69a97d0db4f1a0a983
File without changes
File without changes
data/.gitignore CHANGED
@@ -26,3 +26,4 @@ tmp
26
26
  .kitchen.yml
27
27
  .kitchen.local.yml
28
28
  Berksfile.lock
29
+ *.swp
File without changes
File without changes
File without changes
File without changes
File without changes
data/.yardopts CHANGED
File without changes
data/Berksfile CHANGED
File without changes
@@ -1,5 +1,71 @@
1
1
  # Change Log
2
2
 
3
+ ## [v1.20.0](https://github.com/test-kitchen/test-kitchen/tree/v1.20.0) (2018-01-19)
4
+ [Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.19.2...v1.20.0)
5
+
6
+ **Release Notes:**
7
+
8
+ #### Multiple paths for data_bags
9
+
10
+ Allows a user to use data_bags from an array of directories
11
+
12
+ ```
13
+ data_bags_path:
14
+ - 'data_bags'
15
+ - 'test/integrations/data_bags'
16
+ ```
17
+
18
+ #### Deprecation Warnings for Configuration Keys
19
+
20
+ ```
21
+ $ kitchen list default-centos-7
22
+ $$$$$$ Deprecated configuration detected:
23
+ require_chef_omnibus
24
+ Run 'kitchen doctor' for details.
25
+ ```
26
+
27
+ ```
28
+ $ kitchen doctor
29
+ $$$$$$ Deprecated configuration detected:
30
+ require_chef_omnibus
31
+ Run 'kitchen doctor' for details.
32
+
33
+ -----> The doctor is in
34
+ **** require_chef_omnibus deprecated
35
+ The 'require_chef_omnibus' attribute with version values will change
36
+ to use the new 'product_version' attribute.
37
+
38
+ Note: 'product_name' must be set in order to use 'product_version'
39
+ until 'product_name' replaces 'require_chef_omnibus' as the default.
40
+
41
+ # New Usage #
42
+ provisioner:
43
+ product_name: <chef or chefdk>
44
+ product_version: 12.0.3
45
+ ```
46
+
47
+ #### SSH via an HTTP Proxy
48
+
49
+ This allows configuring the SSH transport to utilize an HTTP Proxy. The following configuration keys have been added to `transport`:
50
+
51
+ ```
52
+ ssh_http_proxy_user
53
+ ssh_http_proxy_password
54
+ ssh_http_proxy_port
55
+ ssh_http_proxy
56
+ ```
57
+
58
+ **Merged pull requests:**
59
+
60
+ - Support multiple paths for data bags [\#1313](https://github.com/test-kitchen/test-kitchen/pull/1313) ([thomasdziedzic](https://github.com/thomasdziedzic))
61
+ - Support for configuration deprecation warnings [\#1303](https://github.com/test-kitchen/test-kitchen/pull/1303) ([wrightp](https://github.com/wrightp))
62
+ - Support for SSH via an HTTP Proxy [\#1329](https://github.com/test-kitchen/test-kitchen/pull/1329) ([NAshwini](https://github.com/NAshwini))
63
+ - Add download support to the base transport and provisioner [\#1306](https://github.com/test-kitchen/test-kitchen/pull/1306) ([atheiman](https://github.com/atheiman))
64
+ - Fix download support for WinRM [\#1338](https://github.com/test-kitchen/test-kitchen/pull/1338) ([gtmanfred](https://github.com/gtmanfred))
65
+ - Fix code to validate retry\_on\_exit\_code [\#1312](https://github.com/test-kitchen/test-kitchen/pull/1312) ([NAshwini](https://github.com/NAshwini))
66
+ - Remove safe\_yaml [\#1328](https://github.com/test-kitchen/test-kitchen/pull/1328) ([coderanger](https://github.com/coderanger))
67
+ - Pin minitest to 5.11 [\#1339](https://github.com/test-kitchen/test-kitchen/pull/1339) ([cheeseplus](https://github.com/cheeseplus))
68
+
3
69
  ## [v1.19.2](https://github.com/test-kitchen/test-kitchen/tree/v1.19.2) (2017-11-28)
4
70
  [Full Changelog](https://github.com/test-kitchen/test-kitchen/compare/v1.19.1...v1.19.2)
5
71
 
File without changes
File without changes
data/Gemfile CHANGED
File without changes
File without changes
data/Guardfile CHANGED
File without changes
data/LICENSE CHANGED
File without changes
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -48,6 +48,7 @@ module Kitchen
48
48
 
49
49
  @instance = instance
50
50
  expand_paths!
51
+ deprecate_config!
51
52
  validate_config!
52
53
  load_needed_dependencies!
53
54
 
@@ -180,6 +181,14 @@ module Kitchen
180
181
  # @api private
181
182
  attr_reader :config
182
183
 
184
+ # @return [Hash] a hash of the detected deprecated config attributes
185
+ # @api private
186
+ attr_reader :deprecated_config
187
+
188
+ # @return [Hash] user provided configuration hash
189
+ # @api private
190
+ attr_reader :provided_config
191
+
183
192
  # Initializes an internal configuration hash. The hash may contain
184
193
  # callable blocks as values that are meant to be called lazily. This
185
194
  # method is intended to be included in an object's .initialize method.
@@ -188,6 +197,7 @@ module Kitchen
188
197
  # @api private
189
198
  def init_config(config)
190
199
  @config = LazyHash.new(config, self)
200
+ @provided_config = config.dup
191
201
  self.class.defaults.each do |attr, value|
192
202
  @config[attr] = value unless @config.key?(attr)
193
203
  end
@@ -213,6 +223,32 @@ module Kitchen
213
223
  end
214
224
  end
215
225
 
226
+ # Initialize detected deprecated configuration hash.
227
+ # Display warning if deprecations have been detected.
228
+ #
229
+ # @api private
230
+ def deprecate_config!
231
+ # We only want to display the deprecation list of config values once per execution on the default config.
232
+ # This prevents the output of deprecations from being printed for each permutation of test suites.
233
+ return if defined? @@has_been_warned_of_deprecations
234
+
235
+ deprecated_attributes = LazyHash.new(self.class.deprecated_attributes, self)
236
+ # Remove items from hash when not provided in the loaded config or when the rendered message is nil
237
+ @deprecated_config = deprecated_attributes.delete_if { |attr, obj| !provided_config.key?(attr) || obj.nil? }
238
+
239
+ if !deprecated_config.empty?
240
+ warning = Util.outdent!(<<-MSG)
241
+ Deprecated configuration detected:
242
+ #{deprecated_config.keys.join("\n")}
243
+ Run 'kitchen doctor' for details.
244
+ MSG
245
+ warn(warning)
246
+
247
+ # Set global var that the deprecation message has been printed
248
+ @@has_been_warned_of_deprecations = true
249
+ end
250
+ end
251
+
216
252
  # Loads any required third party Ruby libraries or runs any shell out
217
253
  # commands to prepare the plugin. This method will be called in the
218
254
  # context of the main thread of execution and so does not necessarily
@@ -451,6 +487,26 @@ module Kitchen
451
487
  expanded_paths[attr] = block_given? ? block : value
452
488
  end
453
489
 
490
+ # Set the appropriate deprecation message for a given attribute name
491
+ #
492
+ # @example the default usage
493
+ #
494
+ # deprecate_config_for :attribute_name, "Detailed deprecation message."
495
+ #
496
+ # @example using a block
497
+ #
498
+ # deprecate_config_for :attribute_name do |subject|
499
+ # "Detailed deprecation message." if subject == true
500
+ # end
501
+ #
502
+ # @param attr [String] configuration attribute name
503
+ # @param value [Object, nil] static default value for attribute
504
+ # @yieldparam object [Object] a reference to the instantiated object
505
+ # @yieldreturn [Object, nil] dynamically computed value for the attribute
506
+ def deprecate_config_for(attr, value = nil, &block)
507
+ deprecated_attributes[attr] = block_given? ? block : value
508
+ end
509
+
454
510
  # Ensures that an attribute must have a non-nil, non-empty String value.
455
511
  # The default behavior will be to raise a user error and thereby halting
456
512
  # further configuration processing. Good use cases for require_config
@@ -520,6 +576,18 @@ module Kitchen
520
576
  end
521
577
  end
522
578
 
579
+ def deprecated_attributes
580
+ @deprecated_attributes ||= {}.merge(super_deprecated_attributes)
581
+ end
582
+
583
+ def super_deprecated_attributes
584
+ if superclass.respond_to?(:deprecated_attributes)
585
+ superclass.deprecated_attributes
586
+ else
587
+ {}
588
+ end
589
+ end
590
+
523
591
  # @return [Hash] a hash of attribute keys and valudation callable blocks
524
592
  # which has been merged with any superclass valudations
525
593
  # @api private
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -80,6 +80,12 @@ module Kitchen
80
80
  debug("Transfer complete")
81
81
  conn.execute(env_cmd(provisioner.prepare_command))
82
82
  conn.execute(env_cmd(provisioner.run_command))
83
+ info("Downloading files from #{instance.to_str}")
84
+ provisioner[:downloads].to_h.each do |remotes, local|
85
+ debug("Downloading #{Array(remotes).join(', ')} to #{local}")
86
+ conn.download(remotes, local)
87
+ end
88
+ debug("Download complete")
83
89
  end
84
90
  rescue Kitchen::Transport::TransportFailed => ex
85
91
  raise ActionFailed, ex.message
File without changes
File without changes
File without changes
@@ -124,6 +124,14 @@ module Kitchen
124
124
  to_hash.each(&block)
125
125
  end
126
126
 
127
+ # Returns a new Hash after deleting the key-value pairs for which the block
128
+ # returns true.
129
+ #
130
+ # @return [Hash] a new hash
131
+ def delete_if(&block)
132
+ to_hash.delete_if(&block)
133
+ end
134
+
127
135
  private
128
136
 
129
137
  # Returns an object or invokes call with context if object is callable.
@@ -18,7 +18,7 @@
18
18
 
19
19
  require "erb"
20
20
  require "vendor/hash_recursive_merge"
21
- require "safe_yaml/load"
21
+ require "yaml"
22
22
 
23
23
  module Kitchen
24
24
  module Loader
@@ -322,7 +322,7 @@ module Kitchen
322
322
  def parse_yaml_string(string, file_name)
323
323
  return {} if string.nil? || string.empty?
324
324
 
325
- result = SafeYAML.load(string) || {}
325
+ result = ::YAML.safe_load(string, [Symbol]) || {}
326
326
  unless result.is_a?(Hash)
327
327
  raise UserError, "Error parsing #{file_name} as YAML " \
328
328
  "(Result of parse was not a Hash, but was a #{result.class}).\n" \
@@ -330,7 +330,7 @@ module Kitchen
330
330
  "debug your issue."
331
331
  end
332
332
  result
333
- rescue SyntaxError, Psych::SyntaxError
333
+ rescue SyntaxError, Psych::SyntaxError, Psych::DisallowedClass
334
334
  raise UserError, "Error parsing #{file_name} as YAML.\n" \
335
335
  "Please run `kitchen diagnose --no-instances --loader' to help " \
336
336
  "debug your issue."
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -47,6 +47,8 @@ module Kitchen
47
47
 
48
48
  default_config :command_prefix, nil
49
49
 
50
+ default_config :downloads, {}
51
+
50
52
  expand_path_for :test_base_path
51
53
 
52
54
  # Constructs a new provisioner by providing a configuration hash.
@@ -78,6 +80,12 @@ module Kitchen
78
80
  config[:max_retries],
79
81
  config[:wait_for_retry]
80
82
  )
83
+ info("Downloading files from #{instance.to_str}")
84
+ config[:downloads].to_h.each do |remotes, local|
85
+ debug("Downloading #{Array(remotes).join(', ')} to #{local}")
86
+ conn.download(remotes, local)
87
+ end
88
+ debug("Download complete")
81
89
  end
82
90
  rescue Kitchen::Transport::TransportFailed => ex
83
91
  raise ActionFailed, ex.message
File without changes
@@ -234,7 +234,11 @@ module Kitchen
234
234
  case opts[:type]
235
235
  when :directory
236
236
  FileUtils.mkdir_p(dest)
237
- FileUtils.cp_r(Util.list_directory(src), dest)
237
+ if src.kind_of?(Array)
238
+ src.each { |x| FileUtils.cp_r(Util.list_directory(x), dest) }
239
+ else
240
+ FileUtils.cp_r(Util.list_directory(src), dest)
241
+ end
238
242
  when :file
239
243
  FileUtils.mkdir_p(File.dirname(dest))
240
244
  FileUtils.cp_r(src, dest)
File without changes
File without changes
@@ -136,6 +136,91 @@ module Kitchen
136
136
 
137
137
  default_config :checksum
138
138
 
139
+ deprecate_config_for :require_chef_omnibus do |provisioner|
140
+ case
141
+ when provisioner[:require_chef_omnibus] == false
142
+ Util.outdent!(<<-MSG)
143
+ The 'require_chef_omnibus' attribute with value of 'false' will
144
+ change to use the new 'install_strategy' attribute with a value of 'skip'.
145
+
146
+ Note: 'product_name' must be set in order to use 'install_strategy'.
147
+ Although this seems counterintuitive, it is necessary until
148
+ 'product_name' replaces 'require_chef_omnibus' as the default.
149
+
150
+ # New Usage #
151
+ provisioner:
152
+ product_name: <chef or chefdk>
153
+ install_strategy: skip
154
+ MSG
155
+ when provisioner[:require_chef_omnibus].to_s.match(/\d/)
156
+ Util.outdent!(<<-MSG)
157
+ The 'require_chef_omnibus' attribute with version values will change
158
+ to use the new 'product_version' attribute.
159
+
160
+ Note: 'product_name' must be set in order to use 'product_version'
161
+ until 'product_name' replaces 'require_chef_omnibus' as the default.
162
+
163
+ # New Usage #
164
+ provisioner:
165
+ product_name: <chef or chefdk>
166
+ product_version: #{provisioner[:require_chef_omnibus]}
167
+ MSG
168
+ when provisioner[:require_chef_omnibus] == "latest"
169
+ Util.outdent!(<<-MSG)
170
+ The 'require_chef_omnibus' attribute with value of 'latest' will change
171
+ to use the new 'install_strategy' attribute with a value of 'always'.
172
+
173
+ Note: 'product_name' must be set in order to use 'install_strategy'
174
+ until 'product_name' replaces 'require_chef_omnibus' as the default.
175
+
176
+ # New Usage #
177
+ provisioner:
178
+ product_name: <chef or chefdk>
179
+ install_strategy: always
180
+ MSG
181
+ end
182
+ end
183
+
184
+ deprecate_config_for :chef_omnibus_url, Util.outdent!(<<-MSG)
185
+ Changing the 'chef_omnibus_url' attribute breaks existing functionality. It will
186
+ be removed in a future version.
187
+ MSG
188
+
189
+ deprecate_config_for :chef_omnibus_install_options, Util.outdent!(<<-MSG)
190
+ The 'chef_omnibus_install_options' attribute will be replaced by using
191
+ 'product_name' and 'channel' attributes.
192
+
193
+ Note: 'product_name' must be set in order to use 'channel'
194
+ until 'product_name' replaces 'require_chef_omnibus' as the default.
195
+
196
+ # Deprecated Example #
197
+ provisioner:
198
+ chef_omnibus_install_options: -P chefdk -c current
199
+
200
+ # New Usage #
201
+ provisioner:
202
+ product_name: chefdk
203
+ channel: current
204
+ MSG
205
+
206
+ deprecate_config_for :install_msi_url, Util.outdent!(<<-MSG)
207
+ The 'install_msi_url' will be relaced by the 'download_url' attribute.
208
+ 'download_url' will be applied to Bourne and Powershell download scripts.
209
+
210
+ Note: 'product_name' must be set in order to use 'download_url'
211
+ until 'product_name' replaces 'require_chef_omnibus' as the default.
212
+
213
+ # New Usage #
214
+ provisioner:
215
+ product_name: <chef or chefdk>
216
+ download_url: http://direct-download-url
217
+ MSG
218
+
219
+ deprecate_config_for :chef_metadata_url, Util.outdent!(<<-MSG)
220
+ The 'chef_metadata_url' will be removed. The Windows metadata URL will be
221
+ fully managed by using attribute settings.
222
+ MSG
223
+
139
224
  # Reads the local Chef::Config object (if present). We do this because
140
225
  # we want to start bring Chef config and ChefDK tool config closer
141
226
  # together. For example, we want to configure proxy settings in 1
@@ -153,6 +238,12 @@ module Kitchen
153
238
  ChefConfig::Config.export_proxies if defined?(ChefConfig::Config.export_proxies)
154
239
  end
155
240
 
241
+ def doctor(state)
242
+ deprecated_config.each do |attr, msg|
243
+ info("**** #{attr} deprecated\n#{msg}")
244
+ end
245
+ end
246
+
156
247
  # (see Base#create_sandbox)
157
248
  def create_sandbox
158
249
  super
@@ -380,6 +471,11 @@ module Kitchen
380
471
  opts[:install_command_options][:checksum] = config[:checksum] if config[:checksum]
381
472
  end
382
473
 
474
+ if instance.driver.cache_directory
475
+ download_dir_option = windows_os? ? :download_directory : :cmdline_dl_dir
476
+ opts[:install_command_options][download_dir_option] = instance.driver.cache_directory
477
+ end
478
+
383
479
  proxies = {}.tap do |prox|
384
480
  [:http_proxy, :https_proxy, :ftp_proxy, :no_proxy].each do |key|
385
481
  prox[key] = config[key] if config[key]