kitchen-vagrant 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +20 -1
- data/lib/kitchen/driver/vagrant.rb +36 -14
- data/lib/kitchen/driver/vagrant_version.rb +1 -1
- data/spec/kitchen/driver/vagrant_spec.rb +2 -35
- data/templates/Vagrantfile.erb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bcdf36e88d6aef140e4c2064a79bda537075114
|
4
|
+
data.tar.gz: 33863859cd3303f848cebbd422fc609de9d0d3b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7b73c8e9312a899cdac7a29cab0e977832186169250d9bbe3e14cdcc206612d43a9412042ec91cdaf69c829c211a4c571135df4a6aae686dcaaf1a5d29d5872
|
7
|
+
data.tar.gz: 39a9416a9f3de64b9571d178f0a34e2a5b69a88fc29230bed61cbb9eda54da62071b09c0b327d89622883bfe169eb0cf29695ae9515e009da5dbe3ad8b479ba5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v1.1.0](https://github.com/test-kitchen/kitchen-vagrant/tree/v1.1.0) (2017-03-31)
|
4
|
+
[Full Changelog](https://github.com/test-kitchen/kitchen-vagrant/compare/v1.0.2...v1.1.0)
|
5
|
+
|
6
|
+
**New Features:**
|
7
|
+
- Make kitchen package work [\#275](https://github.com/test-kitchen/kitchen-vagrant/pull/275) ([ccope](https://github.com/ccope))
|
8
|
+
|
9
|
+
**Improvements:**
|
10
|
+
|
11
|
+
- Only enable the cache when using known bento boxes. Fix \#296 [\#303](https://github.com/test-kitchen/kitchen-vagrant/pull/303) ([cheeseplus](https://github.com/cheeseplus))
|
12
|
+
- README: add info about cache\_directory disabling [\#299](https://github.com/test-kitchen/kitchen-vagrant/pull/299) ([jugatsu](https://github.com/jugatsu))
|
13
|
+
- Add ability to override Kitchen cache directory [\#292](https://github.com/test-kitchen/kitchen-vagrant/pull/292) ([Jakauppila](https://github.com/Jakauppila))
|
14
|
+
- Add support for all misc vagrant providers [\#290](https://github.com/test-kitchen/kitchen-vagrant/pull/290) ([myoung34](https://github.com/myoung34))
|
15
|
+
|
3
16
|
## [v1.0.2](https://github.com/test-kitchen/kitchen-vagrant/tree/v1.0.2) (2017-02-13)
|
4
17
|
[Full Changelog](https://github.com/test-kitchen/kitchen-vagrant/compare/v1.0.1...v1.0.2)
|
5
18
|
|
data/README.md
CHANGED
@@ -463,7 +463,7 @@ end
|
|
463
463
|
|
464
464
|
### <a name="config-cache_directory"></a> cache_directory
|
465
465
|
|
466
|
-
Customize the cache directory on the instance. This parameter must be an
|
466
|
+
Customize the cache directory on the Vagrant instance. This parameter must be an
|
467
467
|
absolute path.
|
468
468
|
|
469
469
|
The defaults are:
|
@@ -478,6 +478,25 @@ driver:
|
|
478
478
|
cache_directory: Z:\\custom\\cache
|
479
479
|
```
|
480
480
|
|
481
|
+
To disable usage of cache directory set `cache_directory` parameter to `false`.
|
482
|
+
|
483
|
+
### <a name="config-kitchen_cache_directory"></a> kitchen_cache_directory
|
484
|
+
|
485
|
+
Customize the kitchen cache directory on the system running Test Kitchen. This parameter must be an
|
486
|
+
absolute path.
|
487
|
+
|
488
|
+
The defaults are:
|
489
|
+
* Windows: `~/.kitchen/cache`
|
490
|
+
* Unix: `~/.kitchen/cache`
|
491
|
+
|
492
|
+
The example:
|
493
|
+
|
494
|
+
```yaml
|
495
|
+
---
|
496
|
+
driver:
|
497
|
+
kitchen_cache_directory: Z:\\custom\\kitchen_cache
|
498
|
+
```
|
499
|
+
|
481
500
|
### <a name="config-vagrantfile-erb"></a> vagrantfile\_erb
|
482
501
|
|
483
502
|
An alternate Vagrantfile ERB template that will be rendered for use by this
|
@@ -86,9 +86,10 @@ module Kitchen
|
|
86
86
|
driver.windows_os? ? nil : "#{driver.instance.name}.vagrantup.com"
|
87
87
|
end
|
88
88
|
|
89
|
-
default_config
|
90
|
-
|
91
|
-
|
89
|
+
default_config :cache_directory, false
|
90
|
+
|
91
|
+
default_config :kitchen_cache_directory,
|
92
|
+
File.expand_path("~/.kitchen/cache")
|
92
93
|
|
93
94
|
default_config :cachier, nil
|
94
95
|
|
@@ -137,6 +138,20 @@ module Kitchen
|
|
137
138
|
state.delete(:hostname)
|
138
139
|
end
|
139
140
|
|
141
|
+
def package(state)
|
142
|
+
if state[:hostname].nil?
|
143
|
+
raise UserError, "Vagrant instance not created!"
|
144
|
+
end
|
145
|
+
if not (config[:ssh] && config[:ssh][:insert_key] == false)
|
146
|
+
m = "Disable vagrant ssh key replacement to preserve the default key!"
|
147
|
+
warn(m)
|
148
|
+
end
|
149
|
+
instance.transport.connection(state).close
|
150
|
+
box_name = File.join(Dir.pwd, instance.name + ".box")
|
151
|
+
run("#{config[:vagrant_binary]} package --output #{box_name}")
|
152
|
+
destroy(state)
|
153
|
+
end
|
154
|
+
|
140
155
|
# A lifecycle method that should be invoked when the object is about
|
141
156
|
# ready to be used. A reference to an Instance is required as
|
142
157
|
# configuration dependant data may be access through an Instance. This
|
@@ -182,8 +197,11 @@ module Kitchen
|
|
182
197
|
# and share a local folder to that directory so that we don't pull them
|
183
198
|
# down every single time
|
184
199
|
def cache_directory
|
185
|
-
|
186
|
-
|
200
|
+
if enable_cache? && !config[:cache_directory]
|
201
|
+
windows_os? ? "/omnibus/cache" : "/tmp/omnibus/cache"
|
202
|
+
else
|
203
|
+
config[:cache_directory]
|
204
|
+
end
|
187
205
|
end
|
188
206
|
|
189
207
|
protected
|
@@ -214,17 +232,21 @@ module Kitchen
|
|
214
232
|
name =~ /^(centos|debian|fedora|freebsd|opensuse|ubuntu|oracle)-/
|
215
233
|
end
|
216
234
|
|
217
|
-
#
|
235
|
+
# Returns whether or not the we expect the box to work with shared folders
|
236
|
+
# by matching against a whitelist of bento boxes
|
237
|
+
# @return [TrueClass,FalseClass] whether or not the box shoud work with
|
238
|
+
# shared folders
|
239
|
+
# @api private
|
240
|
+
def safe_share?(box)
|
241
|
+
box =~ /^bento\/(centos|debian|fedora|opensuse|ubuntu|oracle)-/
|
242
|
+
end
|
243
|
+
|
244
|
+
# Return true if we found the criteria to enable the cache_directory
|
218
245
|
# functionality
|
219
|
-
def
|
220
|
-
|
221
|
-
if windows_host? && config[:provider] != "virtualbox" ||
|
222
|
-
instance.platform.name =~ /(freebsd|macos|osx)/ ||
|
223
|
-
# Disable if cache_directory is set to "false" on .kitchen.yml
|
224
|
-
!config[:cache_directory]
|
246
|
+
def enable_cache?
|
247
|
+
if safe_share?(config[:box])
|
225
248
|
return true
|
226
249
|
end
|
227
|
-
|
228
250
|
# Otherwise
|
229
251
|
false
|
230
252
|
end
|
@@ -462,7 +484,7 @@ module Kitchen
|
|
462
484
|
# @return [String] full absolute path to the kitchen cache directory
|
463
485
|
# @api private
|
464
486
|
def local_kitchen_cache
|
465
|
-
@local_kitchen_cache ||=
|
487
|
+
@local_kitchen_cache ||= config[:kitchen_cache_directory]
|
466
488
|
end
|
467
489
|
|
468
490
|
# @return [String] full local path to the directory containing the
|
@@ -340,32 +340,16 @@ describe Kitchen::Driver::Vagrant do
|
|
340
340
|
expect(driver[:ssh]).to eq(:a => "b", :c => { :d => "e" })
|
341
341
|
end
|
342
342
|
|
343
|
-
it "sets :synced_folders with the cache_directory
|
343
|
+
it "sets :synced_folders with the cache_directory for select bento boxes" do
|
344
|
+
config[:box] = "bento/centos-99"
|
344
345
|
expect(driver[:synced_folders]).to eq([cache_directory_array])
|
345
346
|
end
|
346
347
|
|
347
|
-
it "does not set :synced_folders to cache_directory on windows/non-vbox" do
|
348
|
-
allow(RbConfig::CONFIG).to receive(:[]).with("host_os").
|
349
|
-
and_return("mingw")
|
350
|
-
config[:provider] = "notvbox"
|
351
|
-
expect(driver[:synced_folders]).to eq([])
|
352
|
-
end
|
353
|
-
|
354
348
|
it "does not set :synced_folders to cache_directory on freebsd systems" do
|
355
349
|
allow(platform).to receive(:name).and_return("freebsd-99")
|
356
350
|
expect(driver[:synced_folders]).to eq([])
|
357
351
|
end
|
358
352
|
|
359
|
-
it "does not set :synced_folders to cache_directory on macos systems" do
|
360
|
-
allow(platform).to receive(:name).and_return("macos")
|
361
|
-
expect(driver[:synced_folders]).to eq([])
|
362
|
-
end
|
363
|
-
|
364
|
-
it "does not set :synced_folders to cache_directory on osx systems" do
|
365
|
-
allow(platform).to receive(:name).and_return("osx-99")
|
366
|
-
expect(driver[:synced_folders]).to eq([])
|
367
|
-
end
|
368
|
-
|
369
353
|
it "sets :synced_folders to a custom value" do
|
370
354
|
config[:synced_folders] = [
|
371
355
|
["/host_path", "/vm_path", "create: true, type: :nfs"],
|
@@ -376,7 +360,6 @@ describe Kitchen::Driver::Vagrant do
|
|
376
360
|
File.expand_path("/host_path"),
|
377
361
|
"/vm_path", "create: true, type: :nfs"
|
378
362
|
],
|
379
|
-
cache_directory_array,
|
380
363
|
])
|
381
364
|
end
|
382
365
|
|
@@ -387,7 +370,6 @@ describe Kitchen::Driver::Vagrant do
|
|
387
370
|
|
388
371
|
expect(driver[:synced_folders]).to eq([
|
389
372
|
[File.expand_path("/root/suitey-fooos-99"), "/vm_path", "stuff"],
|
390
|
-
cache_directory_array,
|
391
373
|
])
|
392
374
|
end
|
393
375
|
|
@@ -398,7 +380,6 @@ describe Kitchen::Driver::Vagrant do
|
|
398
380
|
|
399
381
|
expect(driver[:synced_folders]).to eq([
|
400
382
|
[File.expand_path("/kroot/a"), "/vm_path", "stuff"],
|
401
|
-
cache_directory_array,
|
402
383
|
])
|
403
384
|
end
|
404
385
|
|
@@ -409,7 +390,6 @@ describe Kitchen::Driver::Vagrant do
|
|
409
390
|
|
410
391
|
expect(driver[:synced_folders]).to eq([
|
411
392
|
[File.expand_path("/host_path"), "/vm_path", "nil"],
|
412
|
-
cache_directory_array,
|
413
393
|
])
|
414
394
|
end
|
415
395
|
|
@@ -471,14 +451,6 @@ describe Kitchen::Driver::Vagrant do
|
|
471
451
|
|
472
452
|
context "for windows os_types" do
|
473
453
|
|
474
|
-
let(:win_cache_directory_array) do
|
475
|
-
[
|
476
|
-
File.expand_path("~/.kitchen/cache"),
|
477
|
-
"/omnibus/cache",
|
478
|
-
"create: true",
|
479
|
-
]
|
480
|
-
end
|
481
|
-
|
482
454
|
before { allow(platform).to receive(:os_type).and_return("windows") }
|
483
455
|
|
484
456
|
it "sets :vm_hostname to nil by default" do
|
@@ -491,10 +463,6 @@ describe Kitchen::Driver::Vagrant do
|
|
491
463
|
expect(driver[:vm_hostname]).to eq("this-is-a--k")
|
492
464
|
end
|
493
465
|
|
494
|
-
it "sets :synced_folders with the cache_directory by default" do
|
495
|
-
expect(driver[:synced_folders]).to eq([win_cache_directory_array])
|
496
|
-
end
|
497
|
-
|
498
466
|
it "replaces %{instance_name} with instance name in :synced_folders" do
|
499
467
|
config[:synced_folders] = [
|
500
468
|
["/root/%{instance_name}", "/vm_path", "stuff"],
|
@@ -502,7 +470,6 @@ describe Kitchen::Driver::Vagrant do
|
|
502
470
|
|
503
471
|
expect(driver[:synced_folders]).to eq([
|
504
472
|
[File.expand_path("/root/suitey-fooos-99"), "/vm_path", "stuff"],
|
505
|
-
win_cache_directory_array,
|
506
473
|
])
|
507
474
|
end
|
508
475
|
end
|
data/templates/Vagrantfile.erb
CHANGED
@@ -185,7 +185,7 @@ Vagrant.configure("2") do |c|
|
|
185
185
|
<% else %>
|
186
186
|
p.vmx["<%= key %>"] = "<%= value %>"
|
187
187
|
<% end %>
|
188
|
-
<%
|
188
|
+
<% else %>
|
189
189
|
<% if value.is_a? String %>
|
190
190
|
p.<%= key %> = "<%= value%>"
|
191
191
|
<% else %>
|
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.0
|
4
|
+
version: 1.1.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: 2017-
|
11
|
+
date: 2017-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|