kitchen-vagrant 1.1.1 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 863f689f3db93659089b9fab42bc68af9a95ad4b
4
- data.tar.gz: 6dd5c1895f937db1365989ee58f63d5a26ca7c37
3
+ metadata.gz: 078a13d604dea258f0f18bb35b7fd8ab8d005227
4
+ data.tar.gz: 076909d85a9b05c2192aa4665dc4f45757815063
5
5
  SHA512:
6
- metadata.gz: ba910a7a30032b94668729e5624bfbe982432dff9e92d73f01e13b598a5b907a03c7b803306e4f46d039a2caf8a90667ee267f46b0680d28eb3dcc2846f795f3
7
- data.tar.gz: fe28cb8b5d772713b2d9f79afc4010cd73a8d1bcd946a50be31004bce921a2318fd0e4540c89b08c958772eed52d8c4e18674393c1c3e9621517d5c60f03f7e7
6
+ metadata.gz: 6f81440f12beb801b48b1c68718039d6d0ecba362b31a533ffb0005d21e729e326684ac535fcec85f7c622c2396c91d5c1be2045bf14fedd40c32da8a9578993
7
+ data.tar.gz: 2964f0f254af10b7191d1deebeab4eb33c0cae606f8157db893d801d0bf30e0929df217a7bb1c786600a6a9f7399239b883e330e368d275af4cff531898d90bb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## [1.2.0](https://github.com/test-kitchen/kitchen-vagrant/tree/1.2.0) (2017-08-11)
4
+ [Full Changelog](https://github.com/test-kitchen/kitchen-vagrant/compare/v1.1.1...1.2.0)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - Support to create/attach multiple additional VirtualBox disks [\#312](https://github.com/test-kitchen/kitchen-vagrant/pull/312) ([stissot](https://github.com/stissot))
9
+ - Parallel virtualbox [\#202](https://github.com/test-kitchen/kitchen-vagrant/pull/202) ([rveznaver](https://github.com/rveznaver))
10
+
3
11
  ## [v1.1.1](https://github.com/test-kitchen/kitchen-vagrant/tree/v1.1.1) (2017-07-26)
4
12
  [Full Changelog](https://github.com/test-kitchen/kitchen-vagrant/compare/v1.1.0...v1.1.1)
5
13
 
data/README.md CHANGED
@@ -269,7 +269,7 @@ and [VMware][vagrant_config_vmware] for more details.
269
269
  #### <a name="config-customize-virtualbox-disk"></a> VirtualBox additional disk
270
270
 
271
271
  Adding the `createhd` and `storageattach` keys in `customize` allows for creation
272
- of an additional disk in VirtualBox. Full paths must be used as required by VirtualBox.
272
+ of additional disks in VirtualBox. Full paths must be used as required by VirtualBox.
273
273
 
274
274
  *NOTE*: IDE Controller based drives always show up in the boot order first, regardless of if they
275
275
  are [bootable][vbox_ide_boot].
@@ -278,14 +278,21 @@ are [bootable][vbox_ide_boot].
278
278
  driver:
279
279
  customize:
280
280
  createhd:
281
- filename: /tmp/disk1.vmdk
282
- size: 1024
281
+ - filename: /tmp/disk1.vmdk
282
+ size: 1024
283
+ - filename: /tmp/disk2.vmdk
284
+ size: 2048
283
285
  storageattach:
284
- storagectl: SATA Controller
285
- port: 1
286
- device: 0
287
- type: hdd
288
- medium: /tmp/disk1.vmdk
286
+ - storagectl: IDE Controller
287
+ port: 1
288
+ device: 0
289
+ type: hdd
290
+ medium: /tmp/disk2.vmdk
291
+ - storagectl: IDE Controller
292
+ port: 1
293
+ device: 1
294
+ type: hdd
295
+ medium: /tmp/disk2.vmdk
289
296
  ```
290
297
 
291
298
  will generate a Vagrantfile configuration similar to:
@@ -95,7 +95,7 @@ module Kitchen
95
95
 
96
96
  default_config :cachier, nil
97
97
 
98
- no_parallel_for :create, :destroy
98
+ # no_parallel_for :create, :destroy
99
99
 
100
100
  # Creates a Vagrant VM instance.
101
101
  #
@@ -378,6 +378,14 @@ module Kitchen
378
378
  # @see Kitchen::ShellOut.run_command
379
379
  # @api private
380
380
  def run(cmd, options = {})
381
+ if vagrant_root && config[:provider] == "virtualbox"
382
+ require "digest"
383
+ options[:environment] = {} if options[:environment].nil?
384
+ options[:environment]["VBOX_IPC_SOCKETID"] =
385
+ Digest::SHA256.hexdigest(vagrant_root)
386
+ options[:environment]["VBOX_USER_HOME"] = vagrant_root
387
+ debug("Accessing isolated VirtualBox environment in #{vagrant_root}")
388
+ end
381
389
  cmd = "echo #{cmd}" if config[:dry_run]
382
390
  run_command(cmd, { :cwd => vagrant_root }.merge(options))
383
391
  end
@@ -440,6 +448,11 @@ module Kitchen
440
448
  #
441
449
  # @api private
442
450
  def run_pre_create_command
451
+ if vagrant_root && config[:provider] == "virtualbox"
452
+ run("vboxmanage setproperty machinefolder #{vagrant_root}",
453
+ :cwd => config[:kitchen_root])
454
+ debug("Set VirtualBox machinefolder to #{vagrant_root}")
455
+ end
443
456
  if config[:pre_create_command]
444
457
  run(config[:pre_create_command], :cwd => config[:kitchen_root])
445
458
  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.1.1"
24
+ VAGRANT_VERSION = "1.2.0"
25
25
  end
26
26
  end
@@ -1341,11 +1341,11 @@ describe Kitchen::Driver::Vagrant do
1341
1341
  RUBY
1342
1342
  end
1343
1343
 
1344
- it "adds a lines for createhd in :customize" do
1344
+ it "add line for single createhd in :customize" do
1345
1345
  config[:customize] = {
1346
1346
  :createhd => {
1347
- :filename => "./d1.vmdk",
1348
- :size => 10 * 1024,
1347
+ :filename => "./d1.vmdk",
1348
+ :size => 10 * 1024,
1349
1349
  },
1350
1350
  }
1351
1351
  cmd
@@ -1357,7 +1357,30 @@ describe Kitchen::Driver::Vagrant do
1357
1357
  RUBY
1358
1358
  end
1359
1359
 
1360
- it "adds a lines for storageattach in :customize" do
1360
+ it "adds lines for multiple createhd in :customize" do
1361
+ config[:customize] = {
1362
+ :createhd => [
1363
+ {
1364
+ :filename => "./d1.vmdk",
1365
+ :size => 10 * 1024,
1366
+ },
1367
+ {
1368
+ :filename => "./d2.vmdk",
1369
+ :size => 20 * 1024,
1370
+ },
1371
+ ],
1372
+ }
1373
+ cmd
1374
+
1375
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1376
+ c.vm.provider :virtualbox do |p|
1377
+ p.customize ["createhd", "--filename", "./d1.vmdk", "--size", 10240]
1378
+ p.customize ["createhd", "--filename", "./d2.vmdk", "--size", 20480]
1379
+ end
1380
+ RUBY
1381
+ end
1382
+
1383
+ it "adds lines for single storageattach in :customize" do
1361
1384
  config[:customize] = {
1362
1385
  :storageattach => {
1363
1386
  :type => "hdd",
@@ -1373,6 +1396,35 @@ describe Kitchen::Driver::Vagrant do
1373
1396
  RUBY
1374
1397
  end
1375
1398
 
1399
+ it "adds lines for multiple storageattach in :customize" do
1400
+ config[:customize] = {
1401
+ :storageattach => [
1402
+ {
1403
+ :storagectl => "SATA Controller",
1404
+ :port => 1,
1405
+ :device => 0,
1406
+ :type => "hdd",
1407
+ :medium => "./d1.vmdk",
1408
+ },
1409
+ {
1410
+ :storagectl => "SATA Controller",
1411
+ :port => 1,
1412
+ :device => 1,
1413
+ :type => "hdd",
1414
+ :medium => "./d2.vmdk",
1415
+ },
1416
+ ],
1417
+ }
1418
+ cmd
1419
+
1420
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1421
+ c.vm.provider :virtualbox do |p|
1422
+ p.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", 1, "--device", 0, "--type", "hdd", "--medium", "./d1.vmdk"]
1423
+ p.customize ["storageattach", :id, "--storagectl", "SATA Controller", "--port", 1, "--device", 1, "--type", "hdd", "--medium", "./d2.vmdk"]
1424
+ end
1425
+ RUBY
1426
+ end
1427
+
1376
1428
  it "adds a line for cpuidset in :customize" do
1377
1429
  config[:customize] = {
1378
1430
  :cpuidset => %w{00000001 00000002},
@@ -152,18 +152,24 @@ Vagrant.configure("2") do |c|
152
152
  <% end %>
153
153
  <% when "virtualbox" %>
154
154
  <% if key == :createhd %>
155
- p.customize ["createhd", "--filename", "<%= value[:filename] %>", "--size", <%= value[:size] %>]
155
+ <% value = [value] unless value.instance_of?(Array) %>
156
+ <% value.each do |item| %>
157
+ p.customize ["createhd", "--filename", "<%= item[:filename] %>", "--size", <%= item[:size] %>]
158
+ <% end %>
156
159
  <% elsif key == :storageattach %>
157
- <% options = [] %>
158
- <% value.each do |storageattach_option_key, storageattach_option_value|
159
- options << "\"--#{storageattach_option_key}\""
160
- if storageattach_option_value.instance_of? Fixnum
161
- options << storageattach_option_value
162
- else
163
- options << "\"#{storageattach_option_value}\""
164
- end
165
- end %>
160
+ <% value = [value] unless value.instance_of?(Array) %>
161
+ <% value.each do |item| %>
162
+ <% options = [] %>
163
+ <% item.each do |storageattach_option_key, storageattach_option_value|
164
+ options << "\"--#{storageattach_option_key}\""
165
+ if storageattach_option_value.instance_of? Fixnum
166
+ options << storageattach_option_value
167
+ else
168
+ options << "\"#{storageattach_option_value}\""
169
+ end
170
+ end %>
166
171
  p.customize ["storageattach", :id, <%= options.join(', ') %>]
172
+ <% end %>
167
173
  <% elsif key == :cpuidset %>
168
174
  <% ids = [] %>
169
175
  <% value.each do | id |
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.1.1
4
+ version: 1.2.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-07-26 00:00:00.000000000 Z
11
+ date: 2017-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen