kitchen-vagrant 1.5.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d0dbeeece80627d7a63d112b4b4102ef9b1ef9386887f7b2ddabd0b3872a4c3
4
- data.tar.gz: 44a5f9401545f08acc50d6b5e7e29fd1aeee5603e31400b2b63dc8c7d042e485
3
+ metadata.gz: ea05c234c21fba360397e3555d800f354cd9a6997ab16c2ffaceaaaa46c0b52a
4
+ data.tar.gz: d1cb7e7e751b379c04274bb5df10d699d62b42fa39b5d58e97baa37546d9f7a1
5
5
  SHA512:
6
- metadata.gz: 0d6ecfb995d271e318c217ee9294b57bb2d9578b228cd6593a3a8addff97756b98c68fdb9d1886bc3f87e3386fa69ab04f8d55a2ecb75d22bd365a6136754367
7
- data.tar.gz: 0a7dfbdbbd941e9144476006117d3e0e8e291d4f5c0a7b77728e3d7ba5ad0e3d5242fa2486156fccc71d73a3955291db098b17dde8bd848a081442c2527326a7
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['KITCHEN_HYPERV_SWITCH']} | ConvertTo-Json
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) { |driver| driver.default_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) { |driver| driver.default_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
- if not (config[:ssh] && config[:ssh][:insert_key] == false)
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
- box =~ /^bento\/(centos|debian|fedora|opensuse|ubuntu|oracle|amazonlinux)-/
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 >= 12
348
- config[:vm_hostname] = "#{string[0...10]}-#{string[-1]}"
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(%r{^\s*$\n}, "")
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
- env[var] = nil
436
- end
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
- tokens = line.strip.partition(" ")
533
- [tokens.first, tokens.last.delete('"')]
534
- end
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
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for Vagrant Kitchen driver
24
- VAGRANT_VERSION = "1.5.2".freeze
24
+ VAGRANT_VERSION = "1.6.0".freeze
25
25
  end
26
26
  end
@@ -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-<%= File.basename(config[:kitchen_root]) %>-<%= instance.name %>-<%= SecureRandom.uuid %>"
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.5.2
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-05-02 00:00:00.000000000 Z
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: '0'
128
+ version: '2.3'
129
129
  required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - ">="