kitchen-vagrant 0.19.0 → 0.20.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
  SHA1:
3
- metadata.gz: aa2fafbce94824f6ab027a6c789c348f632b1f73
4
- data.tar.gz: 8c9e54c05057b57e46906e737c7a04c20101ede1
3
+ metadata.gz: f0dc4619e60934c3bee08b3a56a3f443d1507e81
4
+ data.tar.gz: 1b12e75c49a66943965fbfcffef1dd57f91d84fd
5
5
  SHA512:
6
- metadata.gz: 21d53d3e3fa7bb48da1bf39d2af83cffeecea6c2d1fbf444ba188eaeb52650a6db05fdb19b552f3e27b3f2d61a2061c4059919a77fb9a3d30d9077345edee5ae
7
- data.tar.gz: abacc35c6a871434db004664a72d88547d008ec9f5b9d3154ba404003233bfbf0e812ac4d1ebf82aa0c4f8ae0d35429ba4fabd995ce32e6142167fed6e430f92
6
+ metadata.gz: 4bfd34c4956cda9d30fa4537e63b21a0b42e2133cae2e8bae9abe43da8627df4c0144a37734dd8b38daeed871c1ecb2115d0bb49a3aa91ad2dc72ac948c1e6f1
7
+ data.tar.gz: c306ce6aafdcfd0f303d0a681da0857c07f6e847b09ba0df643faee89763098cc97ad386117c7df1bc760154a92dbbe9880511eb1678cbd0023a81ddc3c817cc
@@ -4,7 +4,6 @@ rvm:
4
4
  - 2.2
5
5
  - 2.1
6
6
  - 2.0.0
7
- - 1.9.3
8
7
  - ruby-head
9
8
 
10
9
  bundler_args: --without guard
@@ -1,3 +1,37 @@
1
+ ## [0.20.0](https://github.com/test-kitchen/kitchen-vagrant/tree/v0.20.0) (2016-04-07)
2
+ [Full Changelog](https://github.com/test-kitchen/kitchen-vagrant/compare/v0.19.0...v0.20.0)
3
+
4
+ **Implemented enhancements:**
5
+
6
+ - Make Vagrant binary a parameter [\#218](https://github.com/test-kitchen/kitchen-vagrant/issues/218)
7
+ - WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json [\#198](https://github.com/test-kitchen/kitchen-vagrant/issues/198)
8
+ - Default bento boxes should be pulled from Atlas [\#193](https://github.com/test-kitchen/kitchen-vagrant/issues/193)
9
+ - Easily override instance name [\#169](https://github.com/test-kitchen/kitchen-vagrant/issues/169)
10
+ - Easily override instance name [\#169](https://github.com/test-kitchen/kitchen-vagrant/issues/169)
11
+ - Make vagrant binary a parameter [\#219](https://github.com/test-kitchen/kitchen-vagrant/pull/219) ([bheuvel](https://github.com/bheuvel))
12
+ - HyperV acts as OpenStack, CloudStack [\#217](https://github.com/test-kitchen/kitchen-vagrant/pull/217) ([bheuvel](https://github.com/bheuvel))
13
+ - Add support for hyperv customize [\#212](https://github.com/test-kitchen/kitchen-vagrant/pull/212) ([giseongeom](https://github.com/giseongeom))
14
+ - Add option for box\_download\_insecure to be passed to Vagrantfile [\#208](https://github.com/test-kitchen/kitchen-vagrant/pull/208) ([drrk](https://github.com/drrk))
15
+ - fix libvirt customize [\#204](https://github.com/test-kitchen/kitchen-vagrant/pull/204) ([akissa](https://github.com/akissa))
16
+ - Add linked\_clone config option [\#203](https://github.com/test-kitchen/kitchen-vagrant/pull/203) ([bborysenko](https://github.com/bborysenko))
17
+ - Use Bento's Atlas boxes by default if detected [\#195](https://github.com/test-kitchen/kitchen-vagrant/pull/195) ([andytson](https://github.com/andytson))
18
+ - Parallels: Use "memory" and "cpus" customization shortcuts [\#194](https://github.com/test-kitchen/kitchen-vagrant/pull/194) ([legal90](https://github.com/legal90))
19
+ - Add support for boot\_timeout driver setting [\#184](https://github.com/test-kitchen/kitchen-vagrant/pull/184) ([gh2k](https://github.com/gh2k))
20
+ - Fixes box check update bug [\#182](https://github.com/test-kitchen/kitchen-vagrant/pull/182) ([roderickrandolph](https://github.com/roderickrandolph))
21
+ - Add cloudstack support [\#167](https://github.com/test-kitchen/kitchen-vagrant/pull/167) ([miguelaferreira](https://github.com/miguelaferreira))
22
+
23
+ **Fixed bugs:**
24
+
25
+ - setting box\_check\_update to false does not disable box update checking [\#181](https://github.com/test-kitchen/kitchen-vagrant/issues/181)
26
+
27
+ **Merged pull requests:**
28
+
29
+ - Updating readme for Parallels [\#221](https://github.com/test-kitchen/kitchen-vagrant/pull/221) ([cheeseplus](https://github.com/cheeseplus))
30
+ - Adding changelog generator [\#220](https://github.com/test-kitchen/kitchen-vagrant/pull/220) ([cheeseplus](https://github.com/cheeseplus))
31
+ - Updating Readme to reflect changes to default boxes [\#215](https://github.com/test-kitchen/kitchen-vagrant/pull/215) ([cheeseplus](https://github.com/cheeseplus))
32
+ - Ruby 1.9.3 is no longer supported [\#209](https://github.com/test-kitchen/kitchen-vagrant/pull/209) ([drrk](https://github.com/drrk))
33
+
34
+
1
35
  ## 0.19.0 / 2015-09-18
2
36
 
3
37
  ### Bug fixes
data/README.md CHANGED
@@ -33,7 +33,7 @@ If you are creating Windows VMs over a WinRM Transport, then the
33
33
  [vagrant-winrm][vagrant_winrm] Vagrant plugin must be installed. As a
34
34
  consequence, the minimum version of Vagrant required is 1.6 or higher.
35
35
 
36
- ### <a name="dependencies-virtualization"></a> Virtualbox and/or VMware Fusion/Workstation
36
+ ### <a name="dependencies-virtualization"></a> Virtualbox, VMware Fusion/Workstation, and/or Parallels
37
37
 
38
38
  Currently this driver supports VirtualBox and VMware Fusion/Workstation.
39
39
  Virtualbox is free and is the default provider for Vagrant.
@@ -49,6 +49,13 @@ software from VMware and then must also purchase the Vagrant VMware plugin.
49
49
 
50
50
  [VMware Workstation][workstation_dl]
51
51
 
52
+ If you would like to use Parallels you must also purchase the software but the
53
+ `vagrant-parallels` plugin is freely available.
54
+
55
+ [Parllels][parallels_dl]
56
+
57
+ [Vagrant Parallels Provider][vagrant_parallels]
58
+
52
59
 
53
60
  ## <a name="installation"></a> Installation and Setup
54
61
 
@@ -56,21 +63,24 @@ Please read the [Driver usage][driver_usage] page for more details.
56
63
 
57
64
  ## <a name="default-config"></a> Default Configuration
58
65
 
59
- This driver can predict the Vagrant box name and download URL for a select
60
- number of platforms (VirtualBox and VMware providers only) that have been published by
61
- Chef Software Inc, in the [Bento][bento] project such as:
66
+ For a select number of platforms and a select number of hypervisors (VirtualBox, VMware,
67
+ and Parallels) default boxes are published under the [Bento organization][bento_org]
68
+ on [Atlas][atlas] such as:
62
69
 
63
70
  ```yaml
64
71
  ---
65
72
  platforms:
66
- - name: ubuntu-10.04
67
73
  - name: ubuntu-12.04
68
74
  - name: ubuntu-14.04
69
- - name: ubuntu-13.04
70
75
  - name: centos-5.11
71
- - name: centos-6.6
72
- - name: debian-7.8
73
- - name: freebsd-10.1
76
+ - name: centos-6.7
77
+ - name: centos-7.2
78
+ - name: debian-7.9
79
+ - name: debian-8.3
80
+ - name: fedora-22
81
+ - name: fedora-23
82
+ - name: freebsd-9.3
83
+ - name: freebsd-10.2
74
84
  ```
75
85
 
76
86
  This will effectively generate a configuration similar to:
@@ -78,18 +88,21 @@ This will effectively generate a configuration similar to:
78
88
  ```yaml
79
89
  ---
80
90
  platforms:
81
- - name: ubuntu-10.04
82
- driver:
83
- box: opscode-ubuntu-10.04
84
- box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-10.04_chef-provisionerless.box
85
91
  - name: ubuntu-12.04
86
92
  driver:
87
- box: opscode-ubuntu-12.04
88
- box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box
93
+ box: bento/ubuntu-12.04
89
94
  - name: ubuntu-14.04
90
95
  driver:
91
- box: opscode-ubuntu-14.04
92
- box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box
96
+ box: bento/ubuntu-14.04
97
+ - name: centos-5.11
98
+ driver:
99
+ box: bento/centos-5.11
100
+ - name: centos-6.7
101
+ driver:
102
+ box: bento/centos-6.7
103
+ - name: centos-7.2
104
+ driver:
105
+ box: bento/centos-7.2
93
106
  # ...
94
107
  ```
95
108
 
@@ -137,7 +150,7 @@ default `box` value of `"opscode-ubuntu-14.04"`. Alternatively, a box called
137
150
 
138
151
  ### <a name="config-box-check-update"></a> box\_check\_update
139
152
 
140
- Whether to check for box updates (disabled by default).
153
+ Whether to check for box updates (enabled by default).
141
154
 
142
155
  ### <a name="config-box-url"></a> box\_url
143
156
 
@@ -251,6 +264,30 @@ end
251
264
 
252
265
  For more info about GUI vs. Headless mode please see [vagrant configuration docs][vagrant_config_vbox]
253
266
 
267
+ ### <a name="config-linked_clone"></a> linked_clone
268
+
269
+ Allows to use linked clones to import boxes for VirtualBox, VMware and Parallels Desktop. Default is **nil**.
270
+
271
+ ```yaml
272
+ ---
273
+ platforms:
274
+ - name: ubuntu-14.04
275
+ driver:
276
+ linked_clone: true
277
+ ```
278
+
279
+ will generate a Vagrantfile configuration similar to:
280
+
281
+ ```ruby
282
+ Vagrant.configure("2") do |config|
283
+ # ...
284
+
285
+ c.vm.provider :virtualbox do |p|
286
+ p.linked_clone = true
287
+ end
288
+ end
289
+ ```
290
+
254
291
  ### <a name="config-network"></a> network
255
292
 
256
293
  An **Array** of network customizations for the virtual machine. Each Array
@@ -452,3 +489,7 @@ Apache 2.0 (see [LICENSE][license])
452
489
  [vmware_plugin]: http://www.vagrantup.com/vmware
453
490
  [fusion_dl]: http://www.vmware.com/products/fusion/overview.html
454
491
  [workstation_dl]: http://www.vmware.com/products/workstation/
492
+ [bento_org]: https://atlas.hashicorp.com/bento
493
+ [atlas]: https://atlas.hashicorp.com/
494
+ [parallels_dl]: http://www.parallels.com/products/desktop/download/
495
+ [vagrant_parallels]: https://github.com/Parallels/vagrant-parallels
data/Rakefile CHANGED
@@ -35,3 +35,12 @@ desc "Run all quality tasks"
35
35
  task :quality => [:cane, :style, :stats]
36
36
 
37
37
  task :default => [:test, :quality]
38
+
39
+ require "github_changelog_generator/task"
40
+
41
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
42
+ config.future_release = Kitchen::Driver::VAGRANT_VERSION
43
+ config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature,Improvement".split(",")
44
+ config.bug_labels = "bug,Bug".split(",")
45
+ config.exclude_labels = %w[Duplicate Question Discussion No_Changelog]
46
+ end
@@ -25,10 +25,11 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency "rake"
26
26
  gem.add_development_dependency "rspec", "~> 3.2"
27
27
  gem.add_development_dependency "simplecov", "~> 0.9"
28
+ gem.add_development_dependency "github_changelog_generator", "1.11.3"
28
29
 
29
30
  # style and complexity libraries are tightly version pinned as newer releases
30
31
  # may introduce new and undesireable style choices which would be immediately
31
32
  # enforced in CI
32
- gem.add_development_dependency "finstyle", "1.4.0"
33
+ gem.add_development_dependency "finstyle", "1.5.0"
33
34
  gem.add_development_dependency "cane", "2.6.2"
34
35
  end
@@ -43,14 +43,20 @@ module Kitchen
43
43
 
44
44
  default_config :box_check_update, nil
45
45
 
46
+ default_config :box_download_insecure, nil
47
+
46
48
  default_config(:box_url) { |driver| driver.default_box_url }
47
49
 
48
50
  default_config :box_version, nil
49
51
 
52
+ default_config :boot_timeout, nil
53
+
50
54
  default_config :customize, {}
51
55
 
52
56
  default_config :gui, nil
53
57
 
58
+ default_config :linked_clone, nil
59
+
54
60
  default_config :network, []
55
61
 
56
62
  default_config :pre_create_command, nil
@@ -65,6 +71,8 @@ module Kitchen
65
71
 
66
72
  default_config :synced_folders, []
67
73
 
74
+ default_config :vagrant_binary, "vagrant"
75
+
68
76
  default_config :vagrantfile_erb,
69
77
  File.join(File.dirname(__FILE__), "../../../templates/Vagrantfile.erb")
70
78
  expand_path_for :vagrantfile_erb
@@ -94,7 +102,7 @@ module Kitchen
94
102
  # @return [String,nil] the Vagrant box for this Instance
95
103
  def default_box
96
104
  if bento_box?(instance.platform.name)
97
- "opscode-#{instance.platform.name}"
105
+ "bento/#{instance.platform.name}"
98
106
  else
99
107
  instance.platform.name
100
108
  end
@@ -102,15 +110,7 @@ module Kitchen
102
110
 
103
111
  # @return [String,nil] the Vagrant box URL for this Instance
104
112
  def default_box_url
105
- return unless bento_box?(instance.platform.name)
106
-
107
- provider = config[:provider]
108
- provider = "vmware" if config[:provider] =~ /^vmware_(.+)$/
109
-
110
- if %w[virtualbox vmware].include?(provider)
111
- "https://opscode-vm-bento.s3.amazonaws.com/vagrant/#{provider}/" \
112
- "opscode_#{instance.platform.name}_chef-provisionerless.box"
113
- end
113
+ nil
114
114
  end
115
115
 
116
116
  # Destroys an instance.
@@ -123,7 +123,7 @@ module Kitchen
123
123
  create_vagrantfile
124
124
  @vagrantfile_created = false
125
125
  instance.transport.connection(state).close
126
- run("vagrant destroy -f")
126
+ run("#{config[:vagrant_binary]} destroy -f")
127
127
  FileUtils.rm_rf(vagrant_root)
128
128
  info("Vagrant instance #{instance.to_str} destroyed.")
129
129
  state.delete(:hostname)
@@ -367,7 +367,7 @@ module Kitchen
367
367
  #
368
368
  # @api private
369
369
  def run_vagrant_up
370
- cmd = "vagrant up"
370
+ cmd = "#{config[:vagrant_binary]} up"
371
371
  cmd += " --no-provision" unless config[:provision]
372
372
  cmd += " --provider #{config[:provider]}" if config[:provider]
373
373
  run(cmd)
@@ -405,7 +405,8 @@ module Kitchen
405
405
  # invocation
406
406
  # @api private
407
407
  def vagrant_config(type)
408
- lines = run_silently("vagrant #{type}-config").split("\n").map do |line|
408
+ lines = run_silently("#{config[:vagrant_binary]} #{type}-config").
409
+ split("\n").map do |line|
409
410
  tokens = line.strip.partition(" ")
410
411
  [tokens.first, tokens.last.gsub(/"/, "")]
411
412
  end
@@ -417,7 +418,8 @@ module Kitchen
417
418
  # @api private
418
419
  def vagrant_version
419
420
  self.class.vagrant_version ||= run_silently(
420
- "vagrant --version", :cwd => Dir.pwd).chomp.split(" ").last
421
+ "#{config[:vagrant_binary]} --version", :cwd => Dir.pwd).
422
+ chomp.split(" ").last
421
423
  rescue Errno::ENOENT
422
424
  raise UserError, "Vagrant #{MIN_VER} or higher is not installed." \
423
425
  " Please download a package from #{WEBSITE}."
@@ -450,7 +452,7 @@ module Kitchen
450
452
  return true if self.class.winrm_plugin_passed
451
453
 
452
454
  self.class.winrm_plugin_passed = run_silently(
453
- "vagrant plugin list", :cwd => Dir.pwd).
455
+ "#{config[:vagrant_binary]} plugin list", :cwd => Dir.pwd).
454
456
  split("\n").find { |line| line =~ /^vagrant-winrm\s+/ }
455
457
  end
456
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 = "0.19.0"
24
+ VAGRANT_VERSION = "0.20.0"
25
25
  end
26
26
  end
@@ -154,7 +154,7 @@ describe Kitchen::Driver::Vagrant do
154
154
  before { allow(platform).to receive(:name) { "#{name}-99.04" } }
155
155
 
156
156
  it "sets :box based on the platform name by default" do
157
- expect(driver[:box]).to eq("opscode-#{name}-99.04")
157
+ expect(driver[:box]).to eq("bento/#{name}-99.04")
158
158
  end
159
159
 
160
160
  it "sets :box to a custom value" do
@@ -163,25 +163,7 @@ describe Kitchen::Driver::Vagrant do
163
163
  expect(driver[:box]).to eq("booya")
164
164
  end
165
165
 
166
- it "sets :box_url to a bento box URL for a virtualbox provider" do
167
- config[:provider] = "virtualbox"
168
-
169
- expect(driver[:box_url]).to eq(
170
- "https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/" \
171
- "opscode_#{name}-99.04_chef-provisionerless.box"
172
- )
173
- end
174
-
175
- it "sets :box_url to a bento box URL for a vmware-based provider" do
176
- config[:provider] = "vmware_awesometown"
177
-
178
- expect(driver[:box_url]).to eq(
179
- "https://opscode-vm-bento.s3.amazonaws.com/vagrant/vmware/" \
180
- "opscode_#{name}-99.04_chef-provisionerless.box"
181
- )
182
- end
183
-
184
- it "sets :box_url to nil for any other provider" do
166
+ it "sets :box_url to nil" do
185
167
  config[:provider] = "the-next-coolness"
186
168
 
187
169
  expect(driver[:box_url]).to eq(nil)
@@ -218,6 +200,16 @@ describe Kitchen::Driver::Vagrant do
218
200
  expect(driver[:box_check_update]).to eq(true)
219
201
  end
220
202
 
203
+ it "sets :box_download_insecure to nil by default" do
204
+ expect(driver[:box_download_insecure]).to eq(nil)
205
+ end
206
+
207
+ it "sets :box_download_insecure to a custom value" do
208
+ config[:box_download_insecure] = true
209
+
210
+ expect(driver[:box_download_insecure]).to eq(true)
211
+ end
212
+
221
213
  it "sets :box_version to nil by default" do
222
214
  expect(driver[:box_version]).to eq(nil)
223
215
  end
@@ -228,6 +220,16 @@ describe Kitchen::Driver::Vagrant do
228
220
  expect(driver[:box_version]).to eq("1.2.3")
229
221
  end
230
222
 
223
+ it "sets :boot_timeout to nil by default" do
224
+ expect(driver[:boot_timeout]).to eq(nil)
225
+ end
226
+
227
+ it "sets :boot_timeout to a custom value" do
228
+ config[:boot_timeout] = 600
229
+
230
+ expect(driver[:boot_timeout]).to eq(600)
231
+ end
232
+
231
233
  it "sets :customize to an empty hash by default" do
232
234
  expect(driver[:customize]).to eq({})
233
235
  end
@@ -242,6 +244,10 @@ describe Kitchen::Driver::Vagrant do
242
244
  expect(driver[:gui]).to eq(nil)
243
245
  end
244
246
 
247
+ it "sets :linked_clone to nil by default" do
248
+ expect(driver[:linked_clone]).to eq(nil)
249
+ end
250
+
245
251
  it "sets :network to an empty array by default" do
246
252
  expect(driver[:network]).to eq([])
247
253
  end
@@ -354,6 +360,15 @@ describe Kitchen::Driver::Vagrant do
354
360
  ])
355
361
  end
356
362
 
363
+ it "sets :vagrant_binary to 'vagrant' by default" do
364
+ expect(driver[:vagrant_binary]).to eq("vagrant")
365
+ end
366
+
367
+ it "sets :vagrant_binary to a custom value" do
368
+ config[:vagrant_binary] = "vagrant.cmd"
369
+ expect(driver[:vagrant_binary]).to eq("vagrant.cmd")
370
+ end
371
+
357
372
  it "sets :vagrantfile_erb to a default" do
358
373
  expect(driver[:vagrantfile_erb]).to match(
359
374
  %r{/kitchen-vagrant/templates/Vagrantfile\.erb$}
@@ -936,6 +951,22 @@ describe Kitchen::Driver::Vagrant do
936
951
  expect(vagrantfile).to match(regexify(%{c.vm.box_version = "a.b.c"}))
937
952
  end
938
953
 
954
+ it "sets no vm.boot_timeout if missing" do
955
+ config[:boot_timeout] = nil
956
+ cmd
957
+
958
+ expect(vagrantfile).to_not match(regexify(%{c.vm.boot_timeout}, :partial))
959
+ end
960
+
961
+ it "sets no vm.boot_timeout if :boot_timeout is set" do
962
+ config[:boot_timeout] = 600
963
+ cmd
964
+
965
+ expect(vagrantfile).to match(
966
+ regexify(%{c.vm.boot_timeout = 600}, :partial)
967
+ )
968
+ end
969
+
939
970
  it "sets no vm.box_check_update if missing" do
940
971
  config[:box_check_update] = nil
941
972
  cmd
@@ -945,6 +976,13 @@ describe Kitchen::Driver::Vagrant do
945
976
  )
946
977
  end
947
978
 
979
+ it "sets vm.box_check_update to false if :box_check_update is false" do
980
+ config[:box_check_update] = false
981
+ cmd
982
+
983
+ expect(vagrantfile).to match(regexify(%{c.vm.box_check_update = "false"}))
984
+ end
985
+
948
986
  it "sets vm.box_check_update if :box_check_update is set" do
949
987
  config[:box_check_update] = "um"
950
988
  cmd
@@ -952,6 +990,35 @@ describe Kitchen::Driver::Vagrant do
952
990
  expect(vagrantfile).to match(regexify(%{c.vm.box_check_update = "um"}))
953
991
  end
954
992
 
993
+ it "sets no vm.box_download_insecure if missing" do
994
+ config[:box_download_insecure] = nil
995
+ cmd
996
+
997
+ expect(vagrantfile).to_not match(
998
+ regexify(%{c.vm.box_download_insecure}, :partial)
999
+ )
1000
+ end
1001
+
1002
+ it "sets vm.box_download_insecure to false
1003
+ if :box_download_insecure is false" do
1004
+
1005
+ config[:box_download_insecure] = false
1006
+ cmd
1007
+
1008
+ expect(
1009
+ vagrantfile).to match(regexify(%{c.vm.box_download_insecure = "false"})
1010
+ )
1011
+ end
1012
+
1013
+ it "sets vm.box_download_insecure if :box_download_insecure is set" do
1014
+ config[:box_download_insecure] = "um"
1015
+ cmd
1016
+
1017
+ expect(
1018
+ vagrantfile).to match(regexify(%{c.vm.box_download_insecure = "um"})
1019
+ )
1020
+ end
1021
+
955
1022
  it "sets no vm.communicator if missing" do
956
1023
  config[:communicator] = nil
957
1024
  cmd
@@ -1128,6 +1195,36 @@ describe Kitchen::Driver::Vagrant do
1128
1195
  end
1129
1196
  RUBY
1130
1197
  end
1198
+
1199
+ it "does not set :linked_clone to nil" do
1200
+ config[:linked_clone] = nil
1201
+ cmd
1202
+
1203
+ expect(vagrantfile).to_not match(
1204
+ regexify(%{p.linked_clone = }, :partial))
1205
+ end
1206
+
1207
+ it "sets :linked_clone to false if set" do
1208
+ config[:linked_clone] = false
1209
+ cmd
1210
+
1211
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1212
+ c.vm.provider :virtualbox do |p|
1213
+ p.linked_clone = false
1214
+ end
1215
+ RUBY
1216
+ end
1217
+
1218
+ it "sets :linked_clone to true if set" do
1219
+ config[:linked_clone] = true
1220
+ cmd
1221
+
1222
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1223
+ c.vm.provider :virtualbox do |p|
1224
+ p.linked_clone = true
1225
+ end
1226
+ RUBY
1227
+ end
1131
1228
  end
1132
1229
 
1133
1230
  context "for parallels provider" do
@@ -1148,6 +1245,51 @@ describe Kitchen::Driver::Vagrant do
1148
1245
  end
1149
1246
  RUBY
1150
1247
  end
1248
+
1249
+ it "adds a short form of :memory and :cpus elements in :customize" do
1250
+ config[:customize] = {
1251
+ :memory => 2048,
1252
+ :cpus => 4
1253
+ }
1254
+ cmd
1255
+
1256
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1257
+ c.vm.provider :parallels do |p|
1258
+ p.memory = 2048
1259
+ p.cpus = 4
1260
+ end
1261
+ RUBY
1262
+ end
1263
+
1264
+ it "does not set :linked_clone to nil" do
1265
+ config[:linked_clone] = nil
1266
+ cmd
1267
+
1268
+ expect(vagrantfile).to_not match(
1269
+ regexify(%{p.linked_clone = }, :partial))
1270
+ end
1271
+
1272
+ it "sets :linked_clone to false if set" do
1273
+ config[:linked_clone] = false
1274
+ cmd
1275
+
1276
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1277
+ c.vm.provider :parallels do |p|
1278
+ p.linked_clone = false
1279
+ end
1280
+ RUBY
1281
+ end
1282
+
1283
+ it "sets :linked_clone to true if set" do
1284
+ config[:linked_clone] = true
1285
+ cmd
1286
+
1287
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1288
+ c.vm.provider :parallels do |p|
1289
+ p.linked_clone = true
1290
+ end
1291
+ RUBY
1292
+ end
1151
1293
  end
1152
1294
 
1153
1295
  context "for rackspace provider" do
@@ -1213,14 +1355,16 @@ describe Kitchen::Driver::Vagrant do
1213
1355
  it "adds a line for each element in :customize" do
1214
1356
  config[:customize] = {
1215
1357
  :a_key => "some value",
1216
- :something => "else"
1358
+ :something => "else",
1359
+ :a_number_key => 1024
1217
1360
  }
1218
1361
  cmd
1219
1362
 
1220
1363
  expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1221
1364
  c.vm.provider :libvirt do |p|
1222
- p.a_key = some value
1223
- p.something = else
1365
+ p.a_key = "some value"
1366
+ p.something = "else"
1367
+ p.a_number_key = 1024
1224
1368
  end
1225
1369
  RUBY
1226
1370
  end
@@ -1457,6 +1601,180 @@ describe Kitchen::Driver::Vagrant do
1457
1601
  RUBY
1458
1602
  end
1459
1603
  end
1604
+
1605
+ context "for cloudstack provider" do
1606
+
1607
+ before { config[:provider] = "cloudstack" }
1608
+
1609
+ it "adds a line for each element in :customize" do
1610
+ config[:customize] = {
1611
+ :a_key => "some value",
1612
+ :something => "else"
1613
+ }
1614
+ cmd
1615
+
1616
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1617
+ c.vm.provider :cloudstack do |p|
1618
+ p.a_key = "some value"
1619
+ p.something = "else"
1620
+ end
1621
+ RUBY
1622
+ end
1623
+
1624
+ it "builds an array of hashes for firewall rules in :customize" do
1625
+ config[:customize] = {
1626
+ :firewall_rules => [
1627
+ {
1628
+ :ipaddress => "A.A.A.A",
1629
+ :cidrlist => "B.B.B.B/24",
1630
+ :protocol => "tcp",
1631
+ :startport => 2222,
1632
+ :endport => 2222
1633
+ },
1634
+ {
1635
+ :ipaddress => "C.C.C.C",
1636
+ :cidrlist => "D.D.D.D/32",
1637
+ :protocol => "tcp",
1638
+ :startport => 80,
1639
+ :endport => 81
1640
+ }
1641
+ ]
1642
+ }
1643
+ cmd
1644
+
1645
+ expectation = <<-RUBY.gsub(/^ {8}/, "").gsub(/,\n /, ",").chomp
1646
+ c.vm.provider :cloudstack do |p|
1647
+ p.firewall_rules = [{:ipaddress=>"A.A.A.A", :cidrlist=>"B.B.B.B/24",
1648
+ :protocol=>"tcp", :startport=>2222,
1649
+ :endport=>2222}, {:ipaddress=>"C.C.C.C", :cidrlist=>"D.D.D.D/32",
1650
+ :protocol=>"tcp", :startport=>80, :endport=>81}]
1651
+ end
1652
+ RUBY
1653
+
1654
+ expect(vagrantfile).to match(regexify(expectation))
1655
+ end
1656
+
1657
+ it "builds an array for security group ids in :customize" do
1658
+ config[:customize] = {
1659
+ :security_group_ids => ["aaaa-bbbb-cccc-dddd",
1660
+ "1111-2222-3333-4444"]
1661
+ }
1662
+ cmd
1663
+
1664
+ expectation = <<-RUBY.gsub(/^ {8}/, "").gsub(/,\n /, ",").chomp
1665
+ c.vm.provider :cloudstack do |p|
1666
+ p.security_group_ids = ["aaaa-bbbb-cccc-dddd",
1667
+ "1111-2222-3333-4444"]
1668
+ end
1669
+ RUBY
1670
+
1671
+ expect(vagrantfile).to match(regexify(expectation))
1672
+ end
1673
+
1674
+ it "builds an array for security group names in :customize" do
1675
+ config[:customize] = {
1676
+ :security_group_names => %w[min_fantastiska_security_group
1677
+ another_security_group]
1678
+ }
1679
+ cmd
1680
+
1681
+ expectation = <<-RUBY.gsub(/^ {8}/, "").gsub(/,\n /, ",").chomp
1682
+ c.vm.provider :cloudstack do |p|
1683
+ p.security_group_names = ["min_fantastiska_security_group",
1684
+ "another_security_group"]
1685
+ end
1686
+ RUBY
1687
+
1688
+ expect(vagrantfile).to match(regexify(expectation))
1689
+ end
1690
+
1691
+ it "builds an array of hashes for security groups in :customize" do
1692
+ config[:customize] = {
1693
+ :security_groups => [
1694
+ {
1695
+ :name => "Awesome_security_group",
1696
+ :description => "Created from the Vagrantfile",
1697
+ :rules => [
1698
+ {
1699
+ :type => "ingress",
1700
+ :protocol => "TCP",
1701
+ :startport => 22,
1702
+ :endport => 22,
1703
+ :cidrlist => "0.0.0.0/0"
1704
+ },
1705
+ {
1706
+ :type => "egress",
1707
+ :protocol => "TCP",
1708
+ :startport => 81,
1709
+ :endport => 82,
1710
+ :cidrlist => "1.2.3.4/24"
1711
+ }
1712
+ ]
1713
+ }
1714
+ ]
1715
+ }
1716
+ cmd
1717
+
1718
+ expectation = <<-RUBY.gsub(/^ {8}/, "").gsub(/,\n /, ",").chomp
1719
+ c.vm.provider :cloudstack do |p|
1720
+ p.security_groups = [{:name=>"Awesome_security_group",
1721
+ :description=>"Created from the Vagrantfile",
1722
+ :rules=>[{:type=>"ingress", :protocol=>"TCP", :startport=>22,
1723
+ :endport=>22, :cidrlist=>"0.0.0.0/0"}, {:type=>"egress",
1724
+ :protocol=>"TCP", :startport=>81, :endport=>82,
1725
+ :cidrlist=>"1.2.3.4/24"}]}]
1726
+ end
1727
+ RUBY
1728
+
1729
+ expect(vagrantfile).to match(regexify(expectation))
1730
+ end
1731
+
1732
+ it "builds an array of hashes for static nat in :customize" do
1733
+ config[:customize] = {
1734
+ :static_nat => [{ :idaddress => "A.A.A.A" }]
1735
+ }
1736
+ cmd
1737
+
1738
+ expect(vagrantfile).to match(regexify(<<-RUBY.gsub(/^ {8}/, "").chomp))
1739
+ c.vm.provider :cloudstack do |p|
1740
+ p.static_nat = [{:idaddress=>"A.A.A.A"}]
1741
+ end
1742
+ RUBY
1743
+ end
1744
+
1745
+ it "builds an array of hashes for port forwarding rules in :customize" do
1746
+ config[:customize] = {
1747
+ :port_forwarding_rules => [
1748
+ {
1749
+ :ipaddress => "X.X.X.X",
1750
+ :protocol => "tcp",
1751
+ :publicport => 22,
1752
+ :privateport => 22,
1753
+ :openfirewall => false
1754
+ },
1755
+ {
1756
+ :ipaddress => "X.X.X.X",
1757
+ :protocol => "tcp",
1758
+ :publicport => 80,
1759
+ :privateport => 80,
1760
+ :openfirewall => false
1761
+ }
1762
+ ]
1763
+ }
1764
+ cmd
1765
+
1766
+ expectation = <<-RUBY.gsub(/^ {8}/, "").gsub(/,\n /, ",").chomp
1767
+ c.vm.provider :cloudstack do |p|
1768
+ p.port_forwarding_rules = [{:ipaddress=>"X.X.X.X",
1769
+ :protocol=>"tcp", :publicport=>22, :privateport=>22,
1770
+ :openfirewall=>false}, {:ipaddress=>"X.X.X.X", :protocol=>"tcp",
1771
+ :publicport=>80, :privateport=>80, :openfirewall=>false}]
1772
+ end
1773
+ RUBY
1774
+
1775
+ expect(vagrantfile).to match(regexify(expectation))
1776
+ end
1777
+ end
1460
1778
  end
1461
1779
 
1462
1780
  def debug_lines
@@ -14,10 +14,14 @@ Vagrant.configure("2") do |c|
14
14
  c.vm.box_version = "<%= config[:box_version] %>"
15
15
  <% end %>
16
16
 
17
- <% if config[:box_check_update] %>
17
+ <% if !config[:box_check_update].nil? %>
18
18
  c.vm.box_check_update = "<%= config[:box_check_update] %>"
19
19
  <% end %>
20
20
 
21
+ <% if !config[:box_download_insecure].nil? %>
22
+ c.vm.box_download_insecure = "<%= config[:box_download_insecure] %>"
23
+ <% end %>
24
+
21
25
  <% if config[:vm_hostname] %>
22
26
  c.vm.hostname = "<%= config[:vm_hostname] %>"
23
27
  <% end %>
@@ -58,6 +62,10 @@ Vagrant.configure("2") do |c|
58
62
  <% end %>
59
63
  <% end %>
60
64
 
65
+ <% if config[:boot_timeout] %>
66
+ c.vm.boot_timeout = <%= config[:boot_timeout] %>
67
+ <% end %>
68
+
61
69
  <% Array(config[:network]).each do |opts| %>
62
70
  c.vm.network(:<%= opts[0] %>, <%= opts[1..-1].join(", ") %>)
63
71
  <% end %>
@@ -72,12 +80,24 @@ Vagrant.configure("2") do |c|
72
80
  when "virtualbox", /^vmware_/
73
81
  if config[:gui] == true || config[:gui] == false %>
74
82
  p.gui = <%= config[:gui] %>
83
+ <% end
84
+ end
85
+
86
+ case config[:provider]
87
+ when "virtualbox", /^vmware_/, "parallels"
88
+ if config[:linked_clone] == true || config[:linked_clone] == false %>
89
+ p.linked_clone = <%= config[:linked_clone] %>
75
90
  <% end
76
91
  end %>
92
+
77
93
  <% config[:customize].each do |key, value| %>
78
94
  <% case config[:provider]
79
95
  when "libvirt" %>
96
+ <% if value.is_a? String %>
97
+ p.<%= key %> = "<%= value%>"
98
+ <% else %>
80
99
  p.<%= key %> = <%= value%>
100
+ <% end %>
81
101
  <% when "lxc" %>
82
102
  <% if key == :container_name %>
83
103
  p.container_name = <%= value == ":machine" ? value : "\"#{value}\"" %>
@@ -95,7 +115,11 @@ Vagrant.configure("2") do |c|
95
115
  p.server = "<%= value %>"
96
116
  <% end %>
97
117
  <% when "parallels" %>
118
+ <% if key == :memory || key == :cpus %>
119
+ p.<%= key %> = <%= value %>
120
+ <% else %>
98
121
  p.customize ["set", :id, "--<%= key.to_s.gsub('_', '-') %>", "<%= value %>"]
122
+ <% end %>
99
123
  <% when "rackspace" %>
100
124
  p.<%= key %> = "<%= value%>"
101
125
  <% when "softlayer" %>
@@ -118,7 +142,7 @@ Vagrant.configure("2") do |c|
118
142
  <% else %>
119
143
  p.vmx["<%= key %>"] = "<%= value %>"
120
144
  <% end %>
121
- <% when "openstack" %>
145
+ <% when "openstack", "cloudstack", "hyperv" %>
122
146
  <% if value.is_a? String %>
123
147
  p.<%= key %> = "<%= value%>"
124
148
  <% 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: 0.19.0
4
+ version: 0.20.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: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -80,20 +80,34 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: github_changelog_generator
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 1.11.3
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.11.3
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: finstyle
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - '='
88
102
  - !ruby/object:Gem::Version
89
- version: 1.4.0
103
+ version: 1.5.0
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - '='
95
109
  - !ruby/object:Gem::Version
96
- version: 1.4.0
110
+ version: 1.5.0
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: cane
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -150,10 +164,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
164
  version: '0'
151
165
  requirements: []
152
166
  rubyforge_project:
153
- rubygems_version: 2.4.5.1
167
+ rubygems_version: 2.5.2
154
168
  signing_key:
155
169
  specification_version: 4
156
170
  summary: Kitchen::Driver::Vagrant - A Vagrant Driver for Test Kitchen.
157
171
  test_files:
158
172
  - spec/kitchen/driver/vagrant_spec.rb
159
173
  - spec/spec_helper.rb
174
+ has_rdoc: