kitchen-vagrant 1.5.2 → 1.6.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.
- checksums.yaml +4 -4
- data/lib/kitchen/driver/helpers.rb +4 -1
- data/lib/kitchen/driver/vagrant.rb +23 -16
- data/lib/kitchen/driver/vagrant_version.rb +1 -1
- data/templates/Vagrantfile.erb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea05c234c21fba360397e3555d800f354cd9a6997ab16c2ffaceaaaa46c0b52a
|
|
4
|
+
data.tar.gz: d1cb7e7e751b379c04274bb5df10d699d62b42fa39b5d58e97baa37546d9f7a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54f09922713934463de54ec0dfffbc38068730b021b20f1103d2a024c7969c61349d1b422abadd34b347c7193c55df2842d5b5ebf111119fa9ffe162de92769d
|
|
7
|
+
data.tar.gz: 11f919e37cacab6ab7c7d880f6d1834d21b21ecf8a317ed0c1c1adbd16791e6bdd5cab2c65461f32ad59468df92937066ff5bf967e26b8733ada11d4161bce72
|
|
@@ -76,6 +76,7 @@ module Kitchen
|
|
|
76
76
|
sh.run_command
|
|
77
77
|
debug("Local Command END #{Util.duration(sh.execution_time)}")
|
|
78
78
|
raise "Failed: #{sh.stderr}" if sh.error?
|
|
79
|
+
|
|
79
80
|
stdout = sanitize_stdout(sh.stdout)
|
|
80
81
|
JSON.parse(stdout) if stdout.length > 2
|
|
81
82
|
end
|
|
@@ -91,12 +92,13 @@ module Kitchen
|
|
|
91
92
|
default_switch_object["Name"].empty?
|
|
92
93
|
raise "Failed to find a default VM Switch."
|
|
93
94
|
end
|
|
95
|
+
|
|
94
96
|
default_switch_object["Name"]
|
|
95
97
|
end
|
|
96
98
|
|
|
97
99
|
def hyperv_default_switch_ps
|
|
98
100
|
<<-VMSWITCH
|
|
99
|
-
Get-DefaultVMSwitch #{ENV[
|
|
101
|
+
Get-DefaultVMSwitch #{ENV["KITCHEN_HYPERV_SWITCH"]} | ConvertTo-Json
|
|
100
102
|
VMSWITCH
|
|
101
103
|
end
|
|
102
104
|
|
|
@@ -104,6 +106,7 @@ module Kitchen
|
|
|
104
106
|
|
|
105
107
|
def ruby_array_to_ps_array(list)
|
|
106
108
|
return "@()" if list.nil? || list.empty?
|
|
109
|
+
|
|
107
110
|
list.to_s.tr("[]", "()").prepend("@")
|
|
108
111
|
end
|
|
109
112
|
end
|
|
@@ -40,7 +40,7 @@ module Kitchen
|
|
|
40
40
|
|
|
41
41
|
plugin_version Kitchen::Driver::VAGRANT_VERSION
|
|
42
42
|
|
|
43
|
-
default_config(:box
|
|
43
|
+
default_config(:box, &:default_box)
|
|
44
44
|
required_config :box
|
|
45
45
|
|
|
46
46
|
default_config :box_check_update, nil
|
|
@@ -49,7 +49,7 @@ module Kitchen
|
|
|
49
49
|
|
|
50
50
|
default_config :box_download_ca_cert, nil
|
|
51
51
|
|
|
52
|
-
default_config(:box_url
|
|
52
|
+
default_config(:box_url, &:default_box_url)
|
|
53
53
|
|
|
54
54
|
default_config :box_version, nil
|
|
55
55
|
|
|
@@ -149,7 +149,8 @@ module Kitchen
|
|
|
149
149
|
if state[:hostname].nil?
|
|
150
150
|
raise UserError, "Vagrant instance not created!"
|
|
151
151
|
end
|
|
152
|
-
|
|
152
|
+
|
|
153
|
+
unless config[:ssh] && config[:ssh][:insert_key] == false
|
|
153
154
|
m = "Disable vagrant ssh key replacement to preserve the default key!"
|
|
154
155
|
warn(m)
|
|
155
156
|
end
|
|
@@ -247,7 +248,8 @@ module Kitchen
|
|
|
247
248
|
# @api private
|
|
248
249
|
def safe_share?(box)
|
|
249
250
|
return false if config[:provider] =~ /(hyperv|libvirt)/
|
|
250
|
-
|
|
251
|
+
|
|
252
|
+
box =~ %r{^bento/(centos|debian|fedora|opensuse|ubuntu|oracle|amazonlinux)-}
|
|
251
253
|
end
|
|
252
254
|
|
|
253
255
|
# Return true if we found the criteria to enable the cache_directory
|
|
@@ -255,6 +257,7 @@ module Kitchen
|
|
|
255
257
|
def enable_cache?
|
|
256
258
|
return false unless config[:cache_directory]
|
|
257
259
|
return true if safe_share?(config[:box])
|
|
260
|
+
|
|
258
261
|
# Otherwise
|
|
259
262
|
false
|
|
260
263
|
end
|
|
@@ -291,7 +294,8 @@ module Kitchen
|
|
|
291
294
|
def finalize_ca_cert!
|
|
292
295
|
unless config[:box_download_ca_cert].nil?
|
|
293
296
|
config[:box_download_ca_cert] = File.expand_path(
|
|
294
|
-
config[:box_download_ca_cert], config[:kitchen_root]
|
|
297
|
+
config[:box_download_ca_cert], config[:kitchen_root]
|
|
298
|
+
)
|
|
295
299
|
end
|
|
296
300
|
end
|
|
297
301
|
|
|
@@ -344,8 +348,8 @@ module Kitchen
|
|
|
344
348
|
def finalize_vm_hostname!
|
|
345
349
|
string = config[:vm_hostname]
|
|
346
350
|
|
|
347
|
-
if windows_os? && string.is_a?(String) && string.size
|
|
348
|
-
config[:vm_hostname] = "#{string[0...
|
|
351
|
+
if windows_os? && string.is_a?(String) && string.size > 15
|
|
352
|
+
config[:vm_hostname] = "#{string[0...12]}-#{string[-1]}"
|
|
349
353
|
end
|
|
350
354
|
end
|
|
351
355
|
|
|
@@ -382,10 +386,11 @@ module Kitchen
|
|
|
382
386
|
# @api private
|
|
383
387
|
def render_template
|
|
384
388
|
template = File.expand_path(
|
|
385
|
-
config[:vagrantfile_erb], config[:kitchen_root]
|
|
389
|
+
config[:vagrantfile_erb], config[:kitchen_root]
|
|
390
|
+
)
|
|
386
391
|
|
|
387
392
|
if File.exist?(template)
|
|
388
|
-
ERB.new(IO.read(template)).result(binding).gsub(
|
|
393
|
+
ERB.new(IO.read(template)).result(binding).gsub(/^\s*$\n/, "")
|
|
389
394
|
else
|
|
390
395
|
raise ActionFailed, "Could not find Vagrantfile template #{template}"
|
|
391
396
|
end
|
|
@@ -432,8 +437,8 @@ module Kitchen
|
|
|
432
437
|
env = merged[:environment]
|
|
433
438
|
%w{BUNDLE_BIN_PATH BUNDLE_GEMFILE GEM_HOME GEM_PATH GEM_ROOT RUBYLIB
|
|
434
439
|
RUBYOPT _ORIGINAL_GEM_PATH}.each do |var|
|
|
435
|
-
|
|
436
|
-
|
|
440
|
+
env[var] = nil
|
|
441
|
+
end
|
|
437
442
|
|
|
438
443
|
# Altering the path seems to break vagrant. When the :environment
|
|
439
444
|
# is passed to a windows process with a PATH, Vagrant's batch installer
|
|
@@ -529,9 +534,9 @@ module Kitchen
|
|
|
529
534
|
def vagrant_config(type)
|
|
530
535
|
lines = run_silently("#{config[:vagrant_binary]} #{type}-config")
|
|
531
536
|
.split("\n").map do |line|
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
537
|
+
tokens = line.strip.partition(" ")
|
|
538
|
+
[tokens.first, tokens.last.delete('"')]
|
|
539
|
+
end
|
|
535
540
|
Hash[lines]
|
|
536
541
|
end
|
|
537
542
|
|
|
@@ -540,7 +545,8 @@ module Kitchen
|
|
|
540
545
|
# @api private
|
|
541
546
|
def vagrant_version
|
|
542
547
|
self.class.vagrant_version ||= run_silently(
|
|
543
|
-
"#{config[:vagrant_binary]} --version", cwd: Dir.pwd
|
|
548
|
+
"#{config[:vagrant_binary]} --version", cwd: Dir.pwd
|
|
549
|
+
)
|
|
544
550
|
.chomp.split(" ").last
|
|
545
551
|
rescue Errno::ENOENT
|
|
546
552
|
raise UserError, "Vagrant #{MIN_VER} or higher is not installed." \
|
|
@@ -583,7 +589,8 @@ module Kitchen
|
|
|
583
589
|
return true if self.class.winrm_plugin_passed
|
|
584
590
|
|
|
585
591
|
self.class.winrm_plugin_passed = run_silently(
|
|
586
|
-
"#{config[:vagrant_binary]} plugin list", cwd: Dir.pwd
|
|
592
|
+
"#{config[:vagrant_binary]} plugin list", cwd: Dir.pwd
|
|
593
|
+
)
|
|
587
594
|
.split("\n").find { |line| line =~ /vagrant-winrm\s+/ }
|
|
588
595
|
end
|
|
589
596
|
end
|
data/templates/Vagrantfile.erb
CHANGED
|
@@ -108,7 +108,7 @@ Vagrant.configure("2") do |c|
|
|
|
108
108
|
p.linked_clone = <%= config[:linked_clone] %>
|
|
109
109
|
<% end
|
|
110
110
|
when "hyperv" %>
|
|
111
|
-
p.vmname = "kitchen
|
|
111
|
+
p.vmname = "<%="kitchen-#{File.basename(config[:kitchen_root])}-#{instance.name}-#{SecureRandom.uuid}"[0..99].chomp('-') %>"
|
|
112
112
|
<% if config[:linked_clone] == true || config[:linked_clone] == false %>
|
|
113
113
|
p.linked_clone = <%= config[:linked_clone] %>
|
|
114
114
|
<% end
|
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: 1.
|
|
4
|
+
version: 1.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fletcher Nichol
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-08-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
125
125
|
requirements:
|
|
126
126
|
- - ">="
|
|
127
127
|
- !ruby/object:Gem::Version
|
|
128
|
-
version: '
|
|
128
|
+
version: '2.3'
|
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
requirements:
|
|
131
131
|
- - ">="
|