kitchen-vagrant 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.10.0 / 2013-05-08
2
+
3
+ ### New features
4
+
5
+ * Pull request #12: Use SSHBase functionality (using ChefDataUploader) to manage Chef provisioning in the converge action and make Vagrant's built in provisioning an optional mode by setting `use_vagrant_provision: true` in the `driver_config` section of the .kitchen.yml. As a consequence, the vagrant-berkshelf middleware is now also optional and off by default (can be re-enabled by setting `use_vagrant_berkshelf_plugin: true`). (@fujin)
6
+ * Pull request #18: Add VMware Fusion/Workstation support. (@TheDude05)
7
+
8
+ ### Improvements
9
+
10
+ * Issue #19: Recommend the vagrant-wrapper gem in README. (@fnichol)
11
+
12
+
1
13
  ## 0.9.0 / 2013-04-19
2
14
 
3
15
  ### Upstream changes
@@ -54,11 +66,11 @@
54
66
  The initial release.
55
67
 
56
68
  <!--- The following link definition list is generated by PimpMyChangelog --->
57
- [#7]: https://github.com/opscode/kitchen/issues/7
58
- [#8]: https://github.com/opscode/kitchen/issues/8
59
- [#15]: https://github.com/opscode/kitchen/issues/15
60
- [#16]: https://github.com/opscode/kitchen/issues/16
69
+ [#7]: https://github.com/opscode/kitchen-vagrant/issues/7
70
+ [#8]: https://github.com/opscode/kitchen-vagrant/issues/8
71
+ [#15]: https://github.com/opscode/kitchen-vagrant/issues/15
72
+ [#16]: https://github.com/opscode/kitchen-vagrant/issues/16
61
73
  [@fnichol]: https://github.com/fnichol
62
74
  [@martinisoft]: https://github.com/martinisoft
63
75
  [@petejkim]: https://github.com/petejkim
64
- [@sandfish8]: https://github.com/sandfish8
76
+ [@sandfish8]: https://github.com/sandfish8
data/README.md CHANGED
@@ -22,12 +22,27 @@ Test Kitchen.
22
22
  to 1.1.0), this version may be resolved first in your `PATH`. If you receive an
23
23
  error message that Vagrant is too old despite having installed Vagrant as a
24
24
  package, you may be required to uninstall the gem version or modify your `PATH`
25
- environment.
25
+ environment. If you require the vagrant gem for older projects you should
26
+ consider the [vagrant-wrapper][vagrant_wrapper] gem which helps manage both
27
+ styles of Vagrant installations
28
+ ([background details][vagrant_wrapper_background]).
26
29
 
27
- ### <a name="dependencies-virtualbox"></a> Virtualbox
30
+ ### <a name="dependencies-virtualization"></a> Virtualbox and/or VMware Fusion/Workstation
31
+
32
+ Currently this driver supports VirtualBox and VMware Fusion/Workstation.
33
+ Virtualbox is free and is the default provider for Vagrant.
34
+
35
+ [VirtualBox package][virtualbox_dl]
36
+
37
+ If you would like to use VMware Fusion/Workstation you must purchase the
38
+ software from VMware and then must also purchase the Vagrant VMware plugin.
39
+
40
+ [Vagrant VMware Plugin][vmware_plugin]
41
+
42
+ [VMware Fusion][fusion_dl]
43
+
44
+ [VMware Workstation][workstation_dl]
28
45
 
29
- Currently this driver only supports the VirtualBox provisioner which requires
30
- the [VirtualBox package][virtualbox_dl] to be installed.
31
46
 
32
47
  ### <a name="dependencies-berkshelf"></a> Vagrant Berkshelf Plugin
33
48
 
@@ -49,7 +64,7 @@ Please read the [Driver usage][driver_usage] page for more details.
49
64
 
50
65
  ### <a name="config-box"></a> box
51
66
 
52
- (**Required**) This determines which Vagrant box will be used. For more
67
+ **Required** This determines which Vagrant box will be used. For more
53
68
  details, please read the Vagrant [machine settings][vagrant_machine_settings]
54
69
  page.
55
70
 
@@ -63,11 +78,21 @@ started.
63
78
 
64
79
  There is **no** default value set.
65
80
 
81
+ ### <a name="config-provider"></a> provider
82
+
83
+ This determines which Vagrant provider to use when testing and should match
84
+ the provider name in Vagrant. For example, to use VMware Fusion the provider
85
+ should be `vmware_fusion`. Please see the docs on [providers][vagrant_providers]
86
+ for further details.
87
+
88
+ By default the value is unset, or `nil`. In this case the driver will use the
89
+ Vagrant default provider which at this current time is **virtualbox**
90
+
66
91
  ### <a name="config-customize"></a> customize
67
92
 
68
- A **Hash** of customizations to a Vagrant virtual machine backed by VirtualBox.
69
- Each key/value pair will be passed to the `virtualbox.customize` method. For
70
- example:
93
+ A **Hash** of customizations to a Vagrant virtual machine. Each key/value
94
+ pair will be passed to your providers customization block. For example, with
95
+ the default `virtualbox` provider:
71
96
 
72
97
  ```ruby
73
98
  driver_config:
@@ -89,7 +114,7 @@ Vagrant.configure("2") do |config|
89
114
  end
90
115
  ```
91
116
 
92
- Please read the Vagrant [VirtualBox configuration][vagrant_virtualbox] page for
117
+ Please read the [Vagrantfile configuration][vagrantfile] page for
93
118
  more details.
94
119
 
95
120
  By default, each Vagrant virtual machine is configured with 256 MB of RAM. In
@@ -97,8 +122,8 @@ other words the default value for `customize` is `{:memory => '256'}`.
97
122
 
98
123
  ### <a name="config-dry-run"></a> dry\_run
99
124
 
100
- Useful when debugging Vagrant CLI commands. If set to `true`, all Vagrant CLI commands
101
- will be displayed rather than executed.
125
+ Useful when debugging Vagrant CLI commands. If set to `true`, all Vagrant CLI
126
+ commands will be displayed rather than executed.
102
127
 
103
128
  The default is unset, or `nil`.
104
129
 
@@ -131,6 +156,33 @@ more details.
131
156
 
132
157
  There is **no** default value set.
133
158
 
159
+ ### <a name="config-use-vagrant-provision"></a> use_vagrant_provision
160
+
161
+ Determines whether or not this driver will use a `vagrant provision` shell out
162
+ in the **converge** action. If this value is falsey (`nil`, `false`) the
163
+ behavior from `Kitchen::Driver::SSHBase` will be used, bypassing the Vagrant
164
+ Chef solo provisioner. If this value is truthy, a `vagrant provision` will
165
+ be used.
166
+
167
+ The default is unset, or `nil`.
168
+
169
+ ### <a name="config-use-vagrant-berkshelf-plugin"></a> use_vagrant_berkshelf_plugin
170
+
171
+ Determines whether or not this driver will use the vagrant-berkself Vagrant
172
+ plugin to assemble cookbook dependencies. If this value if falsey (`nil`,
173
+ `false`) then the driver will skip the vagrant-berkshelf dependency check
174
+ and not activate the plugin in the rendered Vagrantfile. If this value is
175
+ truthy the opposite behvior will be used.
176
+
177
+ The default is unset, or `nil`.
178
+
179
+ ### <a name="config-synced-folders"></a> synced_folders
180
+
181
+ Allow the user to specify a collection of synced folders for on each Vagrant
182
+ instance.
183
+
184
+ The default is an empty Hash, or `{}`.
185
+
134
186
  ### <a name="config-require-chef-omnibus"></a> require\_chef\_omnibus
135
187
 
136
188
  Determines whether or not a Chef [Omnibus package][chef_omnibus_dl] will be
@@ -182,5 +234,11 @@ Apache 2.0 (see [LICENSE][license])
182
234
  [vagrant_dl]: http://downloads.vagrantup.com/
183
235
  [vagrant_machine_settings]: http://docs.vagrantup.com/v2/vagrantfile/machine_settings.html
184
236
  [vagrant_networking]: http://docs.vagrantup.com/v2/networking/basic_usage.html
185
- [vagrant_virtualbox]: http://docs.vagrantup.com/v2/virtualbox/configuration.html
186
237
  [virtualbox_dl]: https://www.virtualbox.org/wiki/Downloads
238
+ [vagrantfile]: http://docs.vagrantup.com/v2/vagrantfile/index.html
239
+ [vagrant_providers]: http://docs.vagrantup.com/v2/providers/index.html
240
+ [vagrant_wrapper]: https://github.com/org-binbab/gem-vagrant-wrapper
241
+ [vagrant_wrapper_background]: https://github.com/org-binbab/gem-vagrant-wrapper#background---aka-the-vagrant-gem-enigma
242
+ [vmware_plugin]: http://www.vagrantup.com/vmware
243
+ [fusion_dl]: http://www.vmware.com/products/fusion/overview.html
244
+ [workstation_dl]: http://www.vmware.com/products/workstation/
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency 'test-kitchen', '~> 1.0.0.alpha.2'
20
+ gem.add_dependency 'test-kitchen', '~> 1.0.0.alpha.6'
21
21
 
22
22
  gem.add_development_dependency 'cane'
23
23
  gem.add_development_dependency 'tailor'
@@ -35,6 +35,7 @@ module Kitchen
35
35
  class Vagrant < Kitchen::Driver::SSHBase
36
36
 
37
37
  default_config :customize, {:memory => '256'}
38
+ default_config :synced_folders, {}
38
39
 
39
40
  required_config :box
40
41
 
@@ -42,7 +43,9 @@ module Kitchen
42
43
 
43
44
  def create(state)
44
45
  create_vagrantfile
45
- run "vagrant up --no-provision"
46
+ cmd = "vagrant up --no-provision"
47
+ cmd += " --provider=#{@config[:provider]}" if @config[:provider]
48
+ run cmd
46
49
  set_ssh_state(state)
47
50
  info("Vagrant instance #{instance.to_str} created.")
48
51
  end
@@ -51,7 +54,13 @@ module Kitchen
51
54
  create_vagrantfile
52
55
  ssh_args = build_ssh_args(state)
53
56
  install_omnibus(ssh_args) if config[:require_chef_omnibus]
54
- run "vagrant provision"
57
+ if config[:use_vagrant_provision]
58
+ run "vagrant provision"
59
+ else
60
+ prepare_chef_home(ssh_args)
61
+ upload_chef_data(ssh_args)
62
+ run_chef_solo(ssh_args)
63
+ end
55
64
  end
56
65
 
57
66
  def setup(state)
@@ -77,7 +86,7 @@ module Kitchen
77
86
 
78
87
  def verify_dependencies
79
88
  check_vagrant_version
80
- check_berkshelf_plugin
89
+ check_berkshelf_plugin if config[:use_vagrant_berkshelf_plugin]
81
90
  end
82
91
 
83
92
  protected
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for Vagrant Kitchen driver
24
- VAGRANT_VERSION = "0.9.0"
24
+ VAGRANT_VERSION = "0.10.0"
25
25
  end
26
26
  end
@@ -36,8 +36,9 @@ module Kitchen
36
36
  common_block(arr)
37
37
  network_block(arr)
38
38
  provider_block(arr)
39
- chef_block(arr)
40
- berkshelf_block(arr)
39
+ chef_block(arr) if config[:use_vagrant_provision]
40
+ berkshelf_block(arr) if config[:use_vagrant_berkshelf_plugin]
41
+ synced_folders_block(arr)
41
42
  arr << %{end}
42
43
  arr.join("\n")
43
44
  end
@@ -61,10 +62,15 @@ module Kitchen
61
62
  end
62
63
 
63
64
  def provider_block(arr)
64
- arr << %{ c.vm.provider :virtualbox do |p|}
65
- config[:customize].each do |key, value|
66
- arr << %{ p.customize ["modifyvm", :id, "--#{key}", #{value}]}
67
- end
65
+ provider = config[:provider] || 'virtualbox'
66
+
67
+ arr << %{ c.vm.provider :#{provider} do |p|}
68
+ case provider
69
+ when 'virtualbox'
70
+ virtualbox_customize(arr)
71
+ when 'vmware_fusion', 'vmware_workstation'
72
+ vmware_customize(arr)
73
+ end
68
74
  arr << %{ end}
69
75
  end
70
76
 
@@ -76,6 +82,9 @@ module Kitchen
76
82
  if instance.suite.data_bags_path
77
83
  arr << %{ chef.data_bags_path = "#{instance.suite.data_bags_path}"}
78
84
  end
85
+ if key_path
86
+ arr << %{ chef.encrypted_data_bag_secret_key_path = "#{key_path}"}
87
+ end
79
88
  if instance.suite.roles_path
80
89
  arr << %{ chef.roles_path = "#{instance.suite.roles_path}"}
81
90
  end
@@ -91,6 +100,12 @@ module Kitchen
91
100
  end
92
101
  end
93
102
 
103
+ def synced_folders_block(arr)
104
+ config[:synced_folders].each do |source, destination|
105
+ arr << %{ c.vm.synced_folder "#{source}", "#{destination}" }
106
+ end
107
+ end
108
+
94
109
  def vagrant_logger_level
95
110
  if instance.logger.debug?
96
111
  ":debug"
@@ -108,6 +123,39 @@ module Kitchen
108
123
  def berksfile
109
124
  File.join(config[:kitchen_root], "Berksfile")
110
125
  end
126
+
127
+ def virtualbox_customize(arr)
128
+ config[:customize].each do |key, value|
129
+ arr << %{ p.customize ["modifyvm", :id, "--#{key}", #{value}]}
130
+ end
131
+ end
132
+
133
+ def vmware_customize(arr)
134
+ config[:customize].each do |key, value|
135
+ if key == :memory
136
+ # XXX: This is kind of a hack to address the fact that
137
+ # "memory" is a default attribute in our Vagrant driver.
138
+ #
139
+ # The VMware VMX format expects to see "memsize" instead of
140
+ # just "memory" like Virtualbox would. So if "memsize" has
141
+ # been specified we simply ignore the "memory" option.
142
+ unless config[:customize].include?(:memsize)
143
+ arr << %{ p.vmx["memsize"] = "#{value}"}
144
+ end
145
+ else
146
+ arr << %{ p.vmx["#{key}"] = "#{value}"}
147
+ end
148
+ end
149
+ end
150
+
151
+ def key_path
152
+ return nil if instance.suite.encrypted_data_bag_secret_key_path.nil?
153
+
154
+ File.join(
155
+ config[:kitchen_root],
156
+ instance.suite.encrypted_data_bag_secret_key_path
157
+ )
158
+ end
111
159
  end
112
160
  end
113
161
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-vagrant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-19 00:00:00.000000000 Z
12
+ date: 2013-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-kitchen
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.0.alpha.2
21
+ version: 1.0.0.alpha.6
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 1.0.0.alpha.2
29
+ version: 1.0.0.alpha.6
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: cane
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  segments:
109
109
  - 0
110
- hash: 777835139873983513
110
+ hash: 4281053971058593237
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  none: false
113
113
  requirements:
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  segments:
118
118
  - 0
119
- hash: 777835139873983513
119
+ hash: 4281053971058593237
120
120
  requirements: []
121
121
  rubyforge_project:
122
122
  rubygems_version: 1.8.24