test-kitchen 3.9.1 → 4.1.0

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -5
  3. data/lib/kitchen/cli.rb +33 -8
  4. data/lib/kitchen/collection.rb +1 -1
  5. data/lib/kitchen/command/list.rb +49 -9
  6. data/lib/kitchen/command/logs.rb +185 -0
  7. data/lib/kitchen/command/test.rb +2 -1
  8. data/lib/kitchen/command.rb +22 -9
  9. data/lib/kitchen/config.rb +8 -0
  10. data/lib/kitchen/configurable.rb +4 -4
  11. data/lib/kitchen/data_munger.rb +54 -21
  12. data/lib/kitchen/driver/base.rb +19 -0
  13. data/lib/kitchen/driver/dummy.rb +27 -0
  14. data/lib/kitchen/driver/proxy.rb +11 -6
  15. data/lib/kitchen/errors.rb +1 -0
  16. data/lib/kitchen/generator/init.rb +1 -1
  17. data/lib/kitchen/instance.rb +248 -182
  18. data/lib/kitchen/lazy_hash.rb +1 -1
  19. data/lib/kitchen/lifecycle_hook/remote.rb +5 -2
  20. data/lib/kitchen/logger.rb +407 -74
  21. data/lib/kitchen/logging.rb +2 -2
  22. data/lib/kitchen/metadata_chopper.rb +1 -1
  23. data/lib/kitchen/provisioner/base.rb +27 -35
  24. data/lib/kitchen/provisioner/external.rb +420 -0
  25. data/lib/kitchen/provisioner.rb +1 -2
  26. data/lib/kitchen/shell_out.rb +1 -1
  27. data/lib/kitchen/state_file.rb +12 -2
  28. data/lib/kitchen/transport/base.rb +1 -1
  29. data/lib/kitchen/transport/ssh.rb +5 -5
  30. data/lib/kitchen/transport/winrm.rb +8 -8
  31. data/lib/kitchen/util.rb +1 -1
  32. data/lib/kitchen/verifier/base.rb +17 -5
  33. data/lib/kitchen/version.rb +1 -1
  34. data/lib/kitchen.rb +21 -4
  35. data/lib/vendor/hash_recursive_merge.rb +2 -2
  36. data/templates/driver/driver.rb.erb +1 -1
  37. data/test-kitchen.gemspec +5 -7
  38. metadata +36 -41
  39. data/lib/kitchen/driver/ssh_base.rb +0 -346
  40. data/lib/kitchen/provisioner/chef/berkshelf.rb +0 -116
  41. data/lib/kitchen/provisioner/chef/common_sandbox.rb +0 -352
  42. data/lib/kitchen/provisioner/chef/policyfile.rb +0 -173
  43. data/lib/kitchen/provisioner/chef_apply.rb +0 -121
  44. data/lib/kitchen/provisioner/chef_base.rb +0 -723
  45. data/lib/kitchen/provisioner/chef_infra.rb +0 -167
  46. data/lib/kitchen/provisioner/chef_solo.rb +0 -82
  47. data/lib/kitchen/provisioner/chef_target.rb +0 -130
  48. data/lib/kitchen/provisioner/chef_zero.rb +0 -12
  49. data/lib/kitchen/ssh.rb +0 -296
@@ -1,121 +0,0 @@
1
- #
2
- # Author:: SAWANOBORI Yukihiko <sawanoboriyu@higanworks.com>)
3
- #
4
- # Copyright (C) 2015, HiganWorks LLC
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
- # https://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
- # Usage:
19
- #
20
- # puts your recipes to` apply/` directory.
21
- #
22
- # An example of .kitchen.yml.
23
- #
24
- # ---
25
- # driver:
26
- # name: vagrant
27
- #
28
- # provisioner:
29
- # name: chef_apply
30
- #
31
- # platforms:
32
- # - name: ubuntu-24.04
33
- # - name: almalinux-10
34
- #
35
- # suites:
36
- # - name: default
37
- # run_list:
38
- # - recipe1
39
- # - recipe2
40
- #
41
- #
42
- # The chef-apply runs twice below.
43
- #
44
- # chef-apply apply/recipe1.rb
45
- # chef-apply apply/recipe2.rb
46
-
47
- require_relative "chef_base"
48
-
49
- module Kitchen
50
- module Provisioner
51
- # Chef Apply provisioner.
52
- #
53
- # @author SAWANOBORI Yukihiko <sawanoboriyu@higanworks.com>)
54
- class ChefApply < ChefBase
55
- kitchen_provisioner_api_version 2
56
-
57
- plugin_version Kitchen::VERSION
58
-
59
- default_config :chef_apply_path do |provisioner|
60
- provisioner
61
- .remote_path_join(%W{#{provisioner[:chef_omnibus_root]} bin chef-apply})
62
- .tap { |path| path.concat(".bat") if provisioner.windows_os? }
63
- end
64
-
65
- default_config :apply_path do |provisioner|
66
- provisioner.calculate_path("apply")
67
- end
68
- expand_path_for :apply_path
69
-
70
- # (see ChefBase#create_sandbox)
71
- def create_sandbox
72
- @sandbox_path = Dir.mktmpdir("#{instance.name}-sandbox-")
73
- File.chmod(0755, sandbox_path)
74
- info("Preparing files for transfer")
75
- debug("Creating local sandbox in #{sandbox_path}")
76
-
77
- prepare_json
78
- prepare(:apply)
79
- end
80
-
81
- # (see ChefBase#init_command)
82
- def init_command
83
- dirs = %w{
84
- apply
85
- }.sort.map { |dir| remote_path_join(config[:root_path], dir) }
86
-
87
- vars = if powershell_shell?
88
- init_command_vars_for_powershell(dirs)
89
- else
90
- init_command_vars_for_bourne(dirs)
91
- end
92
-
93
- prefix_command(shell_code_from_file(vars, "chef_base_init_command"))
94
- end
95
-
96
- # (see ChefSolo#run_command)
97
- def run_command
98
- level = config[:log_level]
99
- lines = []
100
- config[:run_list].map do |recipe|
101
- cmd = sudo(config[:chef_apply_path]).dup
102
- .tap { |str| str.insert(0, "& ") if powershell_shell? }
103
- args = [
104
- "apply/#{recipe}.rb",
105
- "--log_level #{level}",
106
- "--no-color",
107
- ]
108
- args << "--logfile #{config[:log_file]}" if config[:log_file]
109
- args << "--chef-license #{config[:chef_license]}" if config[:chef_license]
110
-
111
- lines << wrap_shell_code(
112
- [cmd, *args].join(" ")
113
- .tap { |str| str.insert(0, reload_ps1_path) if windows_os? }
114
- )
115
- end
116
-
117
- prefix_command(lines.join("\n"))
118
- end
119
- end
120
- end
121
- end