kitchen-vagrant 2.4.0 → 2.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb41469b88a11508fe064bd6b04389da5cdb617ef027e5a633f47a1c88478be0
4
- data.tar.gz: d4e9d511d64c4bff5a21121f2e2e9bcad8cd453efe7981de9a2c87597bb5f758
3
+ metadata.gz: 6ded9303b651d9e3d46c4d56a805da70902c941946e6f034635e3ccedef10e37
4
+ data.tar.gz: 721a9bdf7801068039a3e4a446f92866e90601fc86f35cf4e4d6a284b62fb95b
5
5
  SHA512:
6
- metadata.gz: 8332c2ee9115ff0c69684420767948b5ad620051b4e99b5ac763e4b08636fe81caa4678ba9ccbbb5e662f6495438499c1fdafd9e7c127738c4219980d61f09f2
7
- data.tar.gz: 163808d47b023456f260985e2180e7de2f46d0b0201729d828bb328d2f16d89c381b4eb7b43191e42a8d4645c14b2e39d6e630409e0847dd01c0e4497235af73
6
+ metadata.gz: 67975ca9f88c44ab626a92acdd66ea6fe077da509ac856c76c1b40f0f36391a33d3d9b55332bd8ad84ccce722ad550460f7072338ef7ae27d240cccc3d920827
7
+ data.tar.gz: 856a7d25b3a15cb4792f07f69b1b20b4c957bf5eaa062f1cfa05a9fe32bd810522072eb46ee88915ebbe4149851b387e8e2b8708df9b66c796daaa7b7c00479c
@@ -127,7 +127,7 @@ module Kitchen
127
127
  # @param cmd [String] command to run locally
128
128
  # @param options [Hash] options hash
129
129
  # @return [Hash,nil] the parsed JSON the script emitted, if any
130
- # @see Kitchen::ShellOut.run_command
130
+ # @see Kitchen::ShellOut#run_command
131
131
  # @api private
132
132
  def run_ps(cmd, options = {})
133
133
  cmd = "echo #{cmd}" if config[:dry_run]
@@ -18,13 +18,9 @@
18
18
  require "erb" unless defined?(Erb)
19
19
  require "fileutils" unless defined?(FileUtils)
20
20
  require "rubygems/version"
21
- # :nocov:
22
- # Chefstyle's Chef/Ruby/UnlessDefinedRequire wants this guard, but the guard's
23
- # other branch is unreachable: kitchen has already loaded "time" by here. The
24
- # repo enforces a branch-coverage floor, so exclude the line rather than let
25
- # the two rules fight.
21
+ # Chefstyle's Chef/Ruby/UnlessDefinedRequire wants this guard, even though the
22
+ # guard's other branch is unreachable: kitchen has already loaded "time" by here.
26
23
  require "time" unless defined?(Time.now.iso8601)
27
- # :nocov:
28
24
 
29
25
  require "kitchen"
30
26
  require_relative "vagrant_version"
@@ -112,11 +108,17 @@ module Kitchen
112
108
  driver.windows_os? ? "/omnibus/cache" : "/tmp/omnibus/cache"
113
109
  end
114
110
 
115
- # for use with vagrant on WSL
116
- user_home = ENV["VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH"].nil? ? "~" : ENV["VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH"]
117
-
118
- default_config :kitchen_cache_directory,
111
+ # Resolved per instance rather than when this file is loaded, so that
112
+ # `VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH` is read at the moment the
113
+ # driver needs it -- the same way `:provider` reads
114
+ # `VAGRANT_DEFAULT_PROVIDER`. Reading it eagerly froze one value into the
115
+ # class for the life of the process, which is wrong for anything that
116
+ # sets the variable after the driver has been required, and made the
117
+ # setting impossible to exercise.
118
+ default_config(:kitchen_cache_directory) do |_|
119
+ user_home = ENV["VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH"] || "~"
119
120
  File.expand_path("#{user_home}/.kitchen/cache")
121
+ end
120
122
 
121
123
  default_config :cachier, nil
122
124
 
@@ -125,6 +127,7 @@ module Kitchen
125
127
  # Creates a Vagrant VM instance.
126
128
  #
127
129
  # @param state [Hash] mutable instance state
130
+ # @return [void]
128
131
  # @raise [ActionFailed] if the action could not be completed
129
132
  def create(state)
130
133
  create_vagrantfile
@@ -165,6 +168,7 @@ module Kitchen
165
168
  # Destroys an instance.
166
169
  #
167
170
  # @param state [Hash] mutable instance state
171
+ # @return [void]
168
172
  # @raise [ActionFailed] if the action could not be completed
169
173
  def destroy(state)
170
174
  return if state[:hostname].nil?
@@ -182,6 +186,7 @@ module Kitchen
182
186
  # current working directory, then destroys the instance.
183
187
  #
184
188
  # @param state [Hash] mutable instance state
189
+ # @return [void]
185
190
  # @raise [UserError] if the instance has not been created
186
191
  # @raise [ActionFailed] if the action could not be completed
187
192
  def package(state)
@@ -246,6 +251,7 @@ module Kitchen
246
251
  # checking for the presence of certain directories, software installed,
247
252
  # etc.
248
253
  #
254
+ # @return [void]
249
255
  # @raise [UserError] if the driver will not be able to perform or if a
250
256
  # documented dependency is missing from the system
251
257
  def verify_dependencies
@@ -303,9 +309,20 @@ module Kitchen
303
309
  MIN_VER = "2.4.0".freeze
304
310
 
305
311
  class << self
306
- # @return [String] the version of Vagrant installed on the workstation
312
+ # Memoises `vagrant --version` for the life of the process, so that
313
+ # every instance in a multi-instance run shells out at most once.
314
+ #
315
+ # @return [String,nil] the version of Vagrant installed on the
316
+ # workstation, or nil before anything has looked it up
307
317
  # @api private
308
318
  attr_accessor :vagrant_version
319
+
320
+ # @!method self.vagrant_version=(value)
321
+ # Records the version of Vagrant found on the workstation.
322
+ #
323
+ # @param value [String] the version string to memoise
324
+ # @return [String] the version string just stored
325
+ # @api private
309
326
  end
310
327
 
311
328
  # Returns whether or not a platform name could have a corresponding Bento
@@ -425,6 +442,7 @@ module Kitchen
425
442
 
426
443
  # Replaces any `{{vagrant_root}}` tokens in the pre create command.
427
444
  #
445
+ # @return [void]
428
446
  # @api private
429
447
  def finalize_pre_create_command!
430
448
  return if config[:pre_create_command].nil?
@@ -636,11 +654,14 @@ module Kitchen
636
654
  end
637
655
  end
638
656
 
639
- # Convenience method to run a command locally.
657
+ # Convenience method to run a command locally, from {#vagrant_root}.
640
658
  #
641
659
  # @param cmd [String] command to run locally
642
660
  # @param options [Hash] options hash
643
- # @see Kitchen::ShellOut.run_command
661
+ # @return [String] the standard output of the command
662
+ # @raise [Kitchen::ShellOut::ShellCommandFailed] if the command exits
663
+ # non-zero
664
+ # @see Kitchen::ShellOut#run_command
644
665
  # @api private
645
666
  def run(cmd, options = {})
646
667
  cmd = "echo #{cmd}" if config[:dry_run]
@@ -662,6 +683,8 @@ module Kitchen
662
683
  # @param cmd [String] command to run locally
663
684
  # @param options [Hash] options hash
664
685
  # @return [String] the standard output of the command
686
+ # @raise [Kitchen::ShellOut::ShellCommandFailed] if the command exits
687
+ # non-zero
665
688
  # @see Kitchen::ShellOut#run_command
666
689
  # rubocop:disable Metrics/CyclomaticComplexity
667
690
  def run_command(cmd, options = {})
@@ -885,7 +908,12 @@ module Kitchen
885
908
  state[:rdp_port] = hash["RDPPort"] if hash["RDPPort"]
886
909
  end
887
910
 
888
- # @return [String] full absolute path to the kitchen cache directory
911
+ # The *host* side of the omnibus package cache: the directory that
912
+ # {#add_extra_synced_folders!} shares into the guest, where it is
913
+ # mounted at {#cache_directory}.
914
+ #
915
+ # @return [String] full absolute path, on the host, to the kitchen
916
+ # cache directory
889
917
  # @api private
890
918
  def local_kitchen_cache
891
919
  @local_kitchen_cache ||= config[:kitchen_cache_directory]
@@ -922,9 +950,15 @@ module Kitchen
922
950
  false
923
951
  end
924
952
 
925
- # Converts a Windows path to a WSL path
926
- # @param path [String] Windows path (e.g., "C:/Users/...")
927
- # @return [String] WSL path (e.g., "/mnt/c/users/...")
953
+ # Converts a Windows path to a WSL path.
954
+ #
955
+ # Anything that does not look like a drive-lettered Windows path is
956
+ # returned untouched. Note that the conversion downcases the whole
957
+ # path, not just the drive letter, so a path whose remainder is
958
+ # case-sensitive does not survive it.
959
+ #
960
+ # @param path [String] Windows path (e.g., `"C:/Users/..."`)
961
+ # @return [String] WSL path (e.g., `"/mnt/c/users/..."`)
928
962
  # @api private
929
963
  def windows_to_wsl_path(path)
930
964
  # Only convert if it looks like a Windows path
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for Vagrant Kitchen driver
24
- VAGRANT_VERSION = "2.4.0".freeze
24
+ VAGRANT_VERSION = "2.4.1".freeze
25
25
  end
26
26
  end
@@ -99,6 +99,8 @@ Vagrant.configure("2") do |c|
99
99
  p.name = "kitchen-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>-<%= SecureRandom.uuid %>"
100
100
  <% when "tart" %>
101
101
  p.name = "kitchen-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>"
102
+ <% when "libvirt" %>
103
+ p.default_prefix = "<%="kitchen-#{File.basename(config[:kitchen_root])}-#{instance.name}-#{SecureRandom.uuid}"[0..99].chomp("-") %>"
102
104
  <% end %>
103
105
 
104
106
  <% case config[:provider]
@@ -257,7 +259,9 @@ Vagrant.configure("2") do |c|
257
259
  end
258
260
 
259
261
  <% if config[:env] && !config[:env].empty? %>
260
- # Set environment variables
262
+ # Environment variables for the *guest*, not for the host's Vagrant
263
+ # process: each entry becomes an export line in /etc/profile.d/kitchen.sh,
264
+ # so it applies to logins on Linux guests only.
261
265
  <% config[:env].each do |env_var| %>
262
266
  c.vm.provision "shell", inline: <<-SHELL
263
267
  echo 'export <%= env_var.gsub("'", "'\\\\''") %>' >> /etc/profile.d/kitchen.sh
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-vagrant
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-24 00:00:00.000000000 Z
11
+ date: 2026-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64