kitchen-vagrant 0.21.0 → 0.21.1

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
  SHA1:
3
- metadata.gz: 8aa643733a8bf6bd645efc9fa0194c06011c74ee
4
- data.tar.gz: 6c27247da25efbeacdddc37a185e578ec92d3d06
3
+ metadata.gz: ad1eb2e544973ec0e6864be3d857c448edce6be0
4
+ data.tar.gz: 80092da59b88a3f00ba1dab7d4160d3bd030c238
5
5
  SHA512:
6
- metadata.gz: 2d941b21d57414cae57419b423c5ff5032d4320a7cd28bb81c1f0bf4047fcfdaf464dde79925d9ccbe24c7d1390977a8ffc61ce3fcae143b363edb54387f4968
7
- data.tar.gz: 48ee12e85af4eeb36976ad354a6ef9f1771fee7e3072e67899a8efffb0b97a9e0a8a1672611047fb6e88d6f4277b7ac52ef160c12f08bb193a7f67fb514edb60
6
+ metadata.gz: e6ea18edbddc33dadcf7ee8be669ab216507364094d6cf04aba8655bff6901449fc7d0217ea351abee4aaa2ca67d4b15a282ab3941daf58e5802f03476287db4
7
+ data.tar.gz: fd16e4495a3b1fd544b267ab8f8fa072e6d417801e0109262c3fe12b51b7abd40c749dcacf6595b8021d7b179ee0988265759960a096e72baa5cbd5001a05104
@@ -1,5 +1,21 @@
1
+ ## [0.21.1](https://github.com/test-kitchen/kitchen-vagrant/tree/0.21.1) (2016-12-05)
2
+ [Full Changelog](https://github.com/test-kitchen/kitchen-vagrant/compare/v0.21.0...v0.21.1)
3
+
4
+ **Implemented enhancements:**
5
+
6
+ - add oracle as supported bento-box type [\#258](https://github.com/test-kitchen/kitchen-vagrant/pull/258) ([lamont-granquist](https://github.com/lamont-granquist))
7
+
8
+ **Fixed bugs:**
9
+
10
+ - Change default cache dir for Windows [\#259](https://github.com/test-kitchen/kitchen-vagrant/pull/259) ([afiune](https://github.com/afiune))
11
+ - Vagrant requires also to scape slashes [\#253](https://github.com/test-kitchen/kitchen-vagrant/pull/253) ([afiune](https://github.com/afiune))
12
+ - Fix cache directory on windows [\#251](https://github.com/test-kitchen/kitchen-vagrant/pull/251) ([afiune](https://github.com/afiune))
13
+ - Exclude freebsd and ability to disable cache dir [\#262](https://github.com/test-kitchen/kitchen-vagrant/pull/262) ([afiune](https://github.com/afiune))
14
+ - Don't alter the path during the bundler cleanup on windows [\#241](https://github.com/test-kitchen/kitchen-vagrant/pull/241) ([mwrock](https://github.com/mwrock))
15
+ - do not map the extra cache drive on non virtualbox windows [\#255](https://github.com/test-kitchen/kitchen-vagrant/pull/255) ([mwrock](https://github.com/mwrock))
16
+
1
17
  ## [0.21.0](https://github.com/test-kitchen/kitchen-vagrant/tree/0.21.0) (2016-11-29)
2
- [Full Changelog](https://github.com/test-kitchen/kitchen-vagrant/compare/v0.20.0...0.21.0)
18
+ [Full Changelog](https://github.com/test-kitchen/kitchen-vagrant/compare/v0.20.0...v0.21.0)
3
19
 
4
20
  **Fixed bugs:**
5
21
 
data/README.md CHANGED
@@ -394,6 +394,23 @@ Vagrant.configure("2") do |config|
394
394
  end
395
395
  ```
396
396
 
397
+ ### <a name="config-cache_directory"></a> cache_directory
398
+
399
+ Customize the cache directory on the instance. This parameter must be an
400
+ absolute path.
401
+
402
+ The defaults are:
403
+ * Windows: `C:\\omnibus\\cache`
404
+ * Unix: `/tmp/omnibus/cache`
405
+
406
+ The example:
407
+
408
+ ```yaml
409
+ ---
410
+ driver:
411
+ cache_directory: Z:\\custom\\cache
412
+ ```
413
+
397
414
  ### <a name="config-vagrantfile-erb"></a> vagrantfile\_erb
398
415
 
399
416
  An alternate Vagrantfile ERB template that will be rendered for use by this
@@ -84,6 +84,10 @@ module Kitchen
84
84
  driver.windows_os? ? nil : driver.instance.name
85
85
  end
86
86
 
87
+ default_config(:cache_directory) do |driver|
88
+ driver.windows_os? ? "/omnibus/cache" : "/tmp/omnibus/cache"
89
+ end
90
+
87
91
  no_parallel_for :create, :destroy
88
92
 
89
93
  # Creates a Vagrant VM instance.
@@ -173,7 +177,8 @@ module Kitchen
173
177
  # and share a local folder to that directory so that we don't pull them
174
178
  # down every single time
175
179
  def cache_directory
176
- windows_os? ? "$env:TEMP\\omnibus\\cache" : "/tmp/omnibus/cache"
180
+ return if disable_cache?
181
+ config[:cache_directory]
177
182
  end
178
183
 
179
184
  protected
@@ -201,7 +206,23 @@ module Kitchen
201
206
  # box
202
207
  # @api private
203
208
  def bento_box?(name)
204
- name =~ /^(centos|debian|fedora|freebsd|opensuse|ubuntu)-/
209
+ name =~ /^(centos|debian|fedora|freebsd|opensuse|ubuntu|oracle)-/
210
+ end
211
+
212
+ # Return true if we found the criteria to disable the cache_directory
213
+ # functionality
214
+ def disable_cache?
215
+ # Disable for Windows not using Virtualbox
216
+ if windows_host? && config[:provider] != "virtualbox" ||
217
+ # Disable for FreeBSD
218
+ instance.platform.name == "freebsd" ||
219
+ # Disable if cache_directory is set to "false" on .kitchen.yml
220
+ !config[:cache_directory]
221
+ return true
222
+ end
223
+
224
+ # Otherwise
225
+ false
205
226
  end
206
227
 
207
228
  # Renders and writes out a Vagrantfile dedicated to this instance.
@@ -337,6 +358,7 @@ module Kitchen
337
358
  # will inherit our bundled environment.
338
359
  # @see https://github.com/test-kitchen/kitchen-vagrant/issues/190
339
360
  # @see Kitchen::ShellOut#run_command
361
+ # rubocop:disable Metrics/CyclomaticComplexity
340
362
  def run_command(cmd, options = {})
341
363
  merged = {
342
364
  :use_sudo => config[:use_sudo],
@@ -355,15 +377,27 @@ module Kitchen
355
377
  RUBYOPT _ORIGINAL_GEM_PATH].each do |var|
356
378
  env[var] = nil
357
379
  end
358
- gem_home = ENV["GEM_HOME"]
359
- if gem_home && (env["PATH"] || ENV["PATH"])
360
- env["PATH"] ||= ENV["PATH"].dup if ENV["PATH"]
361
- gem_bin = File.join(gem_home, "bin") + File::PATH_SEPARATOR
362
- env["PATH"][gem_bin] = "" if env["PATH"].include?(gem_bin)
380
+
381
+ # Altering the path seems to break vagrant. When the :environment
382
+ # is passed to a windows process with a PATH, Vagrant's batch installer
383
+ # (https://github.com/mitchellh/vagrant-installers/blob/master/substrate
384
+ # /modules/vagrant_installer/templates/windows_vagrant.bat.erb)
385
+ # does not efectively prepend the vagrant ruby path in a persistent
386
+ # manner which causes vagrant to use the same ruby as test-kitchen and
387
+ # then the environment is essentially corrupted leading to many errors
388
+ # and dispair
389
+ unless windows_host?
390
+ gem_home = ENV["GEM_HOME"]
391
+ if gem_home && (env["PATH"] || ENV["PATH"])
392
+ env["PATH"] ||= ENV["PATH"].dup if ENV["PATH"]
393
+ gem_bin = File.join(gem_home, "bin") + File::PATH_SEPARATOR
394
+ env["PATH"][gem_bin] = "" if env["PATH"].include?(gem_bin)
395
+ end
363
396
  end
364
397
 
365
398
  super(cmd, merged)
366
399
  end
400
+ # rubocop:enable Metrics/CyclomaticComplexity
367
401
 
368
402
  # Runs a local command before `vagrant up` has been called.
369
403
  #
@@ -473,6 +507,13 @@ module Kitchen
473
507
  end
474
508
  end
475
509
 
510
+ # @return [true,false] whether or not the host is windows
511
+ #
512
+ # @api private
513
+ def windows_host?
514
+ RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
515
+ end
516
+
476
517
  # @return [true,false] whether or not the vagrant-winrm plugin is
477
518
  # installed
478
519
  # @api private
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for Vagrant Kitchen driver
24
- VAGRANT_VERSION = "0.21.0"
24
+ VAGRANT_VERSION = "0.21.1"
25
25
  end
26
26
  end
@@ -136,6 +136,8 @@ describe Kitchen::Driver::Vagrant do
136
136
  end
137
137
 
138
138
  it "fixes path if it notices gem_home in it" do
139
+ allow(RbConfig::CONFIG).to receive(:[]).with("host_os").
140
+ and_return("linux")
139
141
  env.merge!(bundler_env)
140
142
  env["PATH"] = "gem_home/bin#{File::PATH_SEPARATOR}/something/else"
141
143
  options = driver.send(:run_command, "cmd")
@@ -155,7 +157,7 @@ describe Kitchen::Driver::Vagrant do
155
157
  ]
156
158
  end
157
159
 
158
- %W[centos debian fedora opensuse ubuntu].each do |name|
160
+ %W[centos debian fedora opensuse ubuntu oracle freebsd].each do |name|
159
161
 
160
162
  context "for known bento platform names starting with #{name}" do
161
163
 
@@ -328,6 +330,18 @@ describe Kitchen::Driver::Vagrant do
328
330
  expect(driver[:synced_folders]).to eq([cache_directory_array])
329
331
  end
330
332
 
333
+ it "does not set :synced_folders to cache_directory on windows/non-vbox" do
334
+ allow(RbConfig::CONFIG).to receive(:[]).with("host_os").
335
+ and_return("mingw")
336
+ config[:provider] = "notvbox"
337
+ expect(driver[:synced_folders]).to eq([])
338
+ end
339
+
340
+ it "does not set :synced_folders to cache_directory on freebsd systems" do
341
+ allow(platform).to receive(:name).and_return("freebsd")
342
+ expect(driver[:synced_folders]).to eq([])
343
+ end
344
+
331
345
  it "sets :synced_folders to a custom value" do
332
346
  config[:synced_folders] = [
333
347
  ["/host_path", "/vm_path", "create: true, type: :nfs"]
@@ -436,7 +450,7 @@ describe Kitchen::Driver::Vagrant do
436
450
  let(:win_cache_directory_array) do
437
451
  [
438
452
  File.expand_path("~/.kitchen/cache"),
439
- "$env:TEMP\\omnibus\\cache",
453
+ "/omnibus/cache",
440
454
  "create: true"
441
455
  ]
442
456
  end
@@ -468,6 +482,34 @@ describe Kitchen::Driver::Vagrant do
468
482
  ])
469
483
  end
470
484
  end
485
+
486
+ context "when cache_directory is customized" do
487
+
488
+ let(:custom_cache_directory_array) do
489
+ [
490
+ File.expand_path("~/.kitchen/cache"),
491
+ "Z:\\awesome\\cache",
492
+ "create: true"
493
+ ]
494
+ end
495
+
496
+ before { config[:cache_directory] = 'Z:\\awesome\\cache' }
497
+
498
+ it "sets :synced_folders with the custom cache_directory" do
499
+ expect(driver[:synced_folders]).to eq([custom_cache_directory_array])
500
+ end
501
+
502
+ it "replaces %{instance_name} with instance name in :synced_folders" do
503
+ config[:synced_folders] = [
504
+ ["/root/%{instance_name}", "/vm_path", "stuff"]
505
+ ]
506
+
507
+ expect(driver[:synced_folders]).to eq([
508
+ [File.expand_path("/root/suitey-fooos-99"), "/vm_path", "stuff"],
509
+ custom_cache_directory_array
510
+ ])
511
+ end
512
+ end
471
513
  end
472
514
 
473
515
  describe "#verify_dependencies" do
@@ -1188,6 +1230,19 @@ describe Kitchen::Driver::Vagrant do
1188
1230
  RUBY
1189
1231
  end
1190
1232
 
1233
+ it "vm.synced_folder scapes the back slashes for Windows paths" do
1234
+ config[:synced_folders] = [
1235
+ ["/a/b", "C:\\opt\\instance_data", "nil"],
1236
+ ["Z:\\host_path", "/vm_path", "create: true"]
1237
+ ]
1238
+ cmd
1239
+
1240
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {6}/, "").chomp))
1241
+ c.vm.synced_folder "/a/b", "C:\\\\opt\\\\instance_data", nil
1242
+ c.vm.synced_folder "Z:\\\\host_path", "/vm_path", create: true
1243
+ RUBY
1244
+ end
1245
+
1191
1246
  context "for virtualbox provider" do
1192
1247
 
1193
1248
  before { config[:provider] = "virtualbox" }
@@ -17,8 +17,8 @@
17
17
  # limitations under the License.
18
18
 
19
19
  if ENV["CODECLIMATE_REPO_TOKEN"]
20
- require "codeclimate-test-reporter"
21
- CodeClimate::TestReporter.start
20
+ require "simplecov"
21
+ SimpleCov.start
22
22
  elsif ENV["COVERAGE"]
23
23
  require "simplecov"
24
24
  SimpleCov.profiles.define "gem" do
@@ -72,7 +72,7 @@ Vagrant.configure("2") do |c|
72
72
 
73
73
  c.vm.synced_folder ".", "/vagrant", disabled: true
74
74
  <% config[:synced_folders].each do |source, destination, options| %>
75
- c.vm.synced_folder "<%= source %>", "<%= destination %>", <%= options %>
75
+ c.vm.synced_folder <%= source.inspect %>, <%= destination.inspect %>, <%= options %>
76
76
  <% end %>
77
77
 
78
78
  c.vm.provider :<%= config[:provider] %> do |p|
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: 0.21.0
4
+ version: 0.21.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: 2016-11-29 00:00:00.000000000 Z
11
+ date: 2016-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen