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 +4 -4
- data/lib/kitchen/driver/helpers.rb +1 -1
- data/lib/kitchen/driver/vagrant.rb +51 -17
- data/lib/kitchen/driver/vagrant_version.rb +1 -1
- data/templates/Vagrantfile.erb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6ded9303b651d9e3d46c4d56a805da70902c941946e6f034635e3ccedef10e37
|
|
4
|
+
data.tar.gz: 721a9bdf7801068039a3e4a446f92866e90601fc86f35cf4e4d6a284b62fb95b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
-
#
|
|
22
|
-
#
|
|
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
|
-
#
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
#
|
|
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
|
-
# @
|
|
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
|
-
#
|
|
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
|
-
#
|
|
927
|
-
#
|
|
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
|
data/templates/Vagrantfile.erb
CHANGED
|
@@ -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
|
-
#
|
|
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.
|
|
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-
|
|
11
|
+
date: 2026-08-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|