wh-vagrant-vsphere 1.5.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.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.bumpversion.cfg +11 -0
  3. data/.gitignore +8 -0
  4. data/.rubocop.yml +13 -0
  5. data/.rubocop_todo.yml +80 -0
  6. data/.travis.yml +11 -0
  7. data/CHANGELOG.md +244 -0
  8. data/DEVELOPMENT.md +67 -0
  9. data/Gemfile +16 -0
  10. data/LICENSE.txt +24 -0
  11. data/README.md +310 -0
  12. data/Rakefile +20 -0
  13. data/example_box/metadata.json +3 -0
  14. data/lib/vSphere/action.rb +194 -0
  15. data/lib/vSphere/action/clone.rb +244 -0
  16. data/lib/vSphere/action/close_vsphere.rb +22 -0
  17. data/lib/vSphere/action/connect_vsphere.rb +29 -0
  18. data/lib/vSphere/action/destroy.rb +41 -0
  19. data/lib/vSphere/action/get_ssh_info.rb +37 -0
  20. data/lib/vSphere/action/get_state.rb +41 -0
  21. data/lib/vSphere/action/is_created.rb +16 -0
  22. data/lib/vSphere/action/is_running.rb +20 -0
  23. data/lib/vSphere/action/message_already_created.rb +18 -0
  24. data/lib/vSphere/action/message_not_created.rb +18 -0
  25. data/lib/vSphere/action/message_not_running.rb +18 -0
  26. data/lib/vSphere/action/power_off.rb +40 -0
  27. data/lib/vSphere/action/power_on.rb +33 -0
  28. data/lib/vSphere/cap/public_address.rb +15 -0
  29. data/lib/vSphere/config.rb +60 -0
  30. data/lib/vSphere/errors.rb +11 -0
  31. data/lib/vSphere/plugin.rb +44 -0
  32. data/lib/vSphere/provider.rb +39 -0
  33. data/lib/vSphere/util/machine_helpers.rb +20 -0
  34. data/lib/vSphere/util/vim_helpers.rb +91 -0
  35. data/lib/vSphere/util/vm_helpers.rb +39 -0
  36. data/lib/vSphere/version.rb +5 -0
  37. data/lib/vagrant-vsphere.rb +18 -0
  38. data/locales/en.yml +68 -0
  39. data/spec/action_spec.rb +162 -0
  40. data/spec/clone_spec.rb +102 -0
  41. data/spec/connect_vsphere_spec.rb +26 -0
  42. data/spec/destroy_spec.rb +31 -0
  43. data/spec/get_ssh_info_spec.rb +31 -0
  44. data/spec/get_state_spec.rb +55 -0
  45. data/spec/is_created_spec.rb +29 -0
  46. data/spec/power_off_spec.rb +35 -0
  47. data/spec/spec_helper.rb +146 -0
  48. data/vSphere.gemspec +30 -0
  49. data/vsphere_screenshot.png +0 -0
  50. metadata +231 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9cfb77d75b2ac0fc8f8aae3f4db2c2351940851e
4
+ data.tar.gz: e6e410a9d763e40f39a42fc4f4adf584140f31ba
5
+ SHA512:
6
+ metadata.gz: 523074985e889eaa470263540d56c36ebd415c6dc1fd687cdc0815b2c5ba49a4baa75dfd5fc409c956436f47de8ae137abdb03e51a431f499b3db2014bc13885
7
+ data.tar.gz: 386d3ba551be46aedb0adb9e53f39e35f50ce21a650c3e1a326f3f5b208b82c69d6aecc20fca101fb13cf92d0e83a86ee72d69f8306504a67899dcd0487821f8
data/.bumpversion.cfg ADDED
@@ -0,0 +1,11 @@
1
+ [bumpversion]
2
+ current_version = 1.5.0
3
+ tag = true
4
+ commit = true
5
+
6
+ [bumpversion:file:lib/vSphere/version.rb]
7
+
8
+ [bumpversion:file:README.md]
9
+ parse = version: (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
10
+ serialize = version: {major}.{minor}.{patch}
11
+
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ *~
2
+ .vagrant/*
3
+ Vagrantfile
4
+ pkg/*
5
+ *.box
6
+ Gemfile.lock
7
+ /vendor/
8
+ /synced_folders
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Style/FileName:
4
+ Exclude:
5
+ - 'lib/vagrant-vsphere.rb'
6
+
7
+ Lint/RescueException:
8
+ Exclude:
9
+ # the logic in the method `find_clustercompute_or_compute_resource` does not
10
+ # work when rescuing StandardError, so exclude
11
+ # lib/vSphere/util/vim_helpers.rb to continue rescuing Exception in that
12
+ # method
13
+ - 'lib/vSphere/util/vim_helpers.rb'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,80 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2015-09-02 10:38:06 -0600 using RuboCop version 0.32.1.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 1
9
+ Lint/NonLocalExitFromIterator:
10
+ Enabled: false
11
+
12
+ # Offense count: 11
13
+ Metrics/AbcSize:
14
+ Max: 120
15
+
16
+ # Offense count: 1
17
+ # Configuration parameters: CountComments.
18
+ Metrics/ClassLength:
19
+ Max: 169
20
+
21
+ # Offense count: 3
22
+ Metrics/CyclomaticComplexity:
23
+ Max: 18
24
+
25
+ # Offense count: 108
26
+ # Configuration parameters: AllowURI, URISchemes.
27
+ Metrics/LineLength:
28
+ Max: 177
29
+
30
+ # Offense count: 12
31
+ # Configuration parameters: CountComments.
32
+ Metrics/MethodLength:
33
+ Max: 60
34
+
35
+ # Offense count: 1
36
+ # Configuration parameters: CountComments.
37
+ Metrics/ModuleLength:
38
+ Max: 161
39
+
40
+ # Offense count: 3
41
+ Metrics/PerceivedComplexity:
42
+ Max: 19
43
+
44
+ # Offense count: 25
45
+ Style/Documentation:
46
+ Enabled: false
47
+
48
+ # Offense count: 1
49
+ # Cop supports --auto-correct.
50
+ Style/EmptyLiteral:
51
+ Enabled: false
52
+
53
+ # Offense count: 1
54
+ # Cop supports --auto-correct.
55
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
56
+ Style/FirstParameterIndentation:
57
+ Enabled: false
58
+
59
+ # Offense count: 5
60
+ # Cop supports --auto-correct.
61
+ # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
62
+ Style/HashSyntax:
63
+ Enabled: false
64
+
65
+ # Offense count: 2
66
+ # Cop supports --auto-correct.
67
+ # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
68
+ Style/RegexpLiteral:
69
+ Enabled: false
70
+
71
+ # Offense count: 3
72
+ # Cop supports --auto-correct.
73
+ # Configuration parameters: MultiSpaceAllowedForOperators.
74
+ Style/SpaceAroundOperators:
75
+ Enabled: false
76
+
77
+ # Offense count: 4
78
+ # Cop supports --auto-correct.
79
+ Style/SymbolLiteral:
80
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.0.0
5
+
6
+ before_install:
7
+ - rvm @global do gem uninstall bundler --all --executables
8
+ - gem uninstall bundler --all --executables
9
+ - gem install bundler --version '1.6.9'
10
+
11
+ sudo: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,244 @@
1
+ ## [1.5.0 (2015-09-08)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.5.0)
2
+
3
+ - Add support for custom attributes
4
+ ([michaeljb:custom-attributes](https://github.com/nsidc/vagrant-vsphere/pull/149)).
5
+
6
+ ## [1.4.1 (2015-09-01)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.4.1)
7
+
8
+ - Update dependency on [rbvmomi](https://github.com/vmware/rbvmomi) to 1.8.2
9
+ in order to resolve errors with parallelization
10
+ ([#139]((https://github.com/nsidc/vagrant-vsphere/issues/139)),
11
+ [edmcman:master](https://github.com/nsidc/vagrant-vsphere/pull/147)).
12
+
13
+ ## [1.4.0 (2015-07-29)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.4.0)
14
+
15
+ - Add ability to configure the address type (originally submitted in
16
+ [mreuvers:master](https://github.com/nsidc/vagrant-vsphere/pull/121), but
17
+ merged
18
+ [nsidc:address-type](https://github.com/nsidc/vagrant-vsphere/pull/142))
19
+
20
+ ## [1.3.0 (2015-07-21)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.3.0)
21
+
22
+ - Add ability to configure CPU and memory reservations
23
+ ([edmcman:resource_limit](https://github.com/nsidc/vagrant-vsphere/pull/137))
24
+ - Bypass "graceful" shut down attempts with `vagrant destroy --force`
25
+
26
+ ## [1.2.0 (2015-07-09)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.2.0)
27
+
28
+ - Add `public_address` provider capability
29
+ ([mkuzmin:public-address](https://github.com/nsidc/vagrant-vsphere/pull/130))
30
+ - Documentation update
31
+ ([standaloneSA:update-readme](https://github.com/nsidc/vagrant-vsphere/pull/133))
32
+
33
+ ## [1.1.0 (2015-07-09)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.1.0)
34
+
35
+ - Add explicit support for parallelization
36
+ ([xlucas:xlucas-patch-parallelization](https://github.com/nsidc/vagrant-vsphere/pull/126))
37
+ - Documentation updates
38
+ ([metrix78:metrix78-patch-1](https://github.com/nsidc/vagrant-vsphere/pull/127)
39
+ and
40
+ [fabriciocolombo:readme-ipaddress](https://github.com/nsidc/vagrant-vsphere/pull/128))
41
+
42
+ ## 1.0.1 (2015-01-06)
43
+
44
+ - Fix "undefined local variable or method datastore" error due to typo in a
45
+ variable name
46
+ ([#116 mkuzmin:datastore](https://github.com/nsidc/vagrant-vsphere/pull/116))
47
+ - Remove "missing required parameter uuid" error from `vagrant destroy` output
48
+ when no machine exists
49
+ ([#117 mkuzmin:destroy](https://github.com/nsidc/vagrant-vsphere/pull/117))
50
+
51
+ ## 1.0.0 (2015-01-05)
52
+
53
+ - Increase Vagrant requirement to 1.6.4+
54
+ - Update copyright date in LICENSE.txt
55
+
56
+ ## 0.19.1 (2014-12-31)
57
+
58
+ - Move version history and contributing notes out of `README.md` into separate
59
+ files
60
+ - Add RuboCop, fail the Travis-CI build if RuboCop or unit tests fail
61
+
62
+ ## 0.19.0 (2014-12-31)
63
+
64
+ - Add support for ClusterComputeResource and DatastoreCluster
65
+ ([#101 GregDomjan:StorageSDRS](https://github.com/nsidc/vagrant-vsphere/pull/101))
66
+
67
+ ## 0.18.0 (2014-12-30)
68
+
69
+ - Gracefully power off the VM with `vagrant halt`, and shutdown before
70
+ deleting the VM with `vagrant destroy`
71
+ ([#104 clintoncwolfe:shutdown-guest-on-halt](https://github.com/nsidc/vagrant-vsphere/pull/104))
72
+ - Add configuration option `mac` to specify a MAC address for the VM
73
+ ([#108 dataplayer:master](https://github.com/nsidc/vagrant-vsphere/pull/108))
74
+
75
+ ## 0.17.0 (2014-12-29)
76
+
77
+ - Add ability to configure the CPU Count
78
+ ([#96 rylarson:add-cpu-configuration](https://github.com/nsidc/vagrant-vsphere/pull/96))
79
+ - Prompt the user to enter a password if none is given, or the configuration
80
+ value is set to `:ask`
81
+ ([#97 topmedia:password-prompt](https://github.com/nsidc/vagrant-vsphere/pull/97))
82
+ - Add support for `vagrant reload`
83
+ ([#105 clintoncwolfe:add-reload-action](https://github.com/nsidc/vagrant-vsphere/pull/105))
84
+ - Fix compatibility with Vagrant 1.7 to use vSphere connection info from a
85
+ base box
86
+ ([#111 mkuzmin:get-state](https://github.com/nsidc/vagrant-vsphere/pull/111))
87
+
88
+ ## 0.16.0 (2014-10-01)
89
+
90
+ - Add ability to configure amount of memory the new cloned VM will have
91
+ ([#94 rylarson:add-memory-configuration](https://github.com/nsidc/vagrant-vsphere/pull/94))
92
+
93
+ ## 0.15.0 (2014-09-23)
94
+
95
+ - Make `vagrant destroy` work in all vm states
96
+ ([#93 rylarson:make-destroy-work-in-all-vm-states](https://github.com/nsidc/vagrant-vsphere/pull/93),
97
+ fixes [#77](https://github.com/nsidc/vagrant-vsphere/issues/77))
98
+ - If the VM is powered on, then it is powered off, and destroyed
99
+ - If the VM is powered off, it is just destroyed
100
+ - If the VM is suspended, it is powered on, then powered off, then
101
+ destroyed
102
+
103
+ ## 0.14.0 (2014-09-19)
104
+
105
+ - Add vlan configuration
106
+ ([#91 rylarson:add-vlan-configuration](https://github.com/nsidc/vagrant-vsphere/pull/91))
107
+ - Added a new configuration option `vlan` that lets you specify the vlan
108
+ string
109
+ - If vlan is set, the clone spec is modified with an edit action to connect
110
+ the first NIC on the VM to the configured VLAN
111
+
112
+ ## 0.13.1 (2014-09-18)
113
+
114
+ - Change Nokogiri major version dependency
115
+ ([#90 highsineburgh:SAITRADLab-master](https://github.com/nsidc/vagrant-vsphere/pull/90))
116
+
117
+ ## 0.13.0 (2014-09-03)
118
+
119
+ - Find and install box file for multi-provider boxes automatically
120
+ ([#86 mkuzmin:install-box](https://github.com/nsidc/vagrant-vsphere/pull/86)
121
+ &
122
+ [#87 mkuzmin/provider-name](https://github.com/nsidc/vagrant-vsphere/pull/87))
123
+
124
+ ## 0.12.0 (2014-08-16)
125
+
126
+ - Use a directory name where `Vagrantfile` is stored as a prefix for VM name
127
+ ([#82 mkuzmin:name-prefix](https://github.com/nsidc/vagrant-vsphere/pull/82))
128
+
129
+ ## 0.11.0 (2014-07-17)
130
+
131
+ - Create the VM target folder if it doesn't exist
132
+ ([#76 marnovdm:feature/create_vm_folder](https://github.com/nsidc/vagrant-vsphere/pull/76))
133
+
134
+ ## 0.10.0 (2014-07-07)
135
+
136
+ - New optional parameter to clone into custom folder in vSphere
137
+ ([#73 mikola-spb:vm-base-path](https://github.com/nsidc/vagrant-vsphere/pull/73))
138
+ - Follows [semver](http://semver.org/) better, this adds functionality in a
139
+ backwards compatible way, so bumps the minor. 0.9.0, should have been a
140
+ major version
141
+
142
+ ## 0.9.2 (2014-07-07)
143
+
144
+ - Instruct Vagrant to set the guest hostname according to `Vagrantfile`
145
+ ([#69 ddub:set-hostname](https://github.com/nsidc/vagrant-vsphere/pull/69))
146
+
147
+ ## 0.9.1 (2014-07-07)
148
+
149
+ - Reuse folder sync code from Vagrant core
150
+ ([#66 mkuzmin:sync-folders](https://github.com/nsidc/vagrant-vsphere/pull/66))
151
+
152
+ ## 0.9.0 (2014-07-07)
153
+
154
+ - Increases Vagrant requirements to 1.6.3+
155
+ - Supports differentiating between SSH/WinRM communicator
156
+ ([#67 marnovdm:feature/waiting-for-winrm](https://github.com/nsidc/vagrant-vsphere/pull/67))
157
+
158
+ ## 0.8.5 (2014-07-07)
159
+
160
+ - Fixed synced folders to work with WinRM communicator
161
+ ([#72 10thmagnitude:master](https://github.com/nsidc/vagrant-vsphere/pull/72))
162
+
163
+ ## 0.8.4 (2014-07-07)
164
+
165
+ - Use root resource pool when cloning from template
166
+ ([#63: matt-richardson:support-resource-pools-on-vsphere-standard-edition](https://github.com/nsidc/vagrant-vsphere/pull/63))
167
+
168
+ ## 0.8.3 (2014-07-03)
169
+
170
+ - Fixed "No error message" on rbvmomi method calls
171
+ ([#74: mkuzmin:rbvmomi-error-messages](https://github.com/nsidc/vagrant-vsphere/pull/74))
172
+
173
+ ## 0.8.2 (2014-04-23)
174
+
175
+ - Fixes no error messages
176
+ ([#58 leth:no-error-message](https://github.com/nsidc/vagrant-vsphere/pull/58))
177
+ - Fixes typo ([#57 marnovdm](https://github.com/nsidc/vagrant-vsphere/pull/57))
178
+ - Fixes additional no error messages
179
+
180
+ ## 0.8.1 (2014-04-10)
181
+
182
+ - Fixes [#47](https://github.com/nsidc/vagrant-vsphere/issues/47) via
183
+ [#52 olegz-alertlogic](https://github.com/nsidc/vagrant-vsphere/pull/52)
184
+
185
+ ## 0.8.0 (2014-04-08)
186
+
187
+ - Adds configuration for connecting via proxy server
188
+ ([#40 tkak:feature-proxy-connection](https://github.com/nsidc/vagrant-vsphere/pull/40))
189
+
190
+ ## 0.7.2 (2014-04-08)
191
+
192
+ - Includes template in get_location
193
+ ([#38 tim95030:issue-27](https://github.com/nsidc/vagrant-vsphere/pull/38))
194
+ - Updates `Gemfile` to fall back to old version of Vagrant if ruby < 2.0.0 is
195
+ available
196
+
197
+ ## 0.7.1 (2014-03-17)
198
+
199
+ - Fixes rsync error reporting
200
+ - Updates `locales/en.yaml`
201
+ - Restricts RbVmomi dependency
202
+
203
+ ## 0.7.0 (2013-12-31)
204
+
205
+ - Handle multiple private key paths
206
+ - Add auto name generation based on machine name
207
+ - Add support for linked clones
208
+
209
+ ## 0.6.0 (2013-11-21)
210
+
211
+ - Add support for the `vagrant ssh -c` command
212
+
213
+ ## 0.5.1 (2013-10-21)
214
+
215
+ - Fix rsync on Windows, adapted from
216
+ [mitchellh/vagrant-aws#77](https://github.com/mitchellh/vagrant-aws/pull/77)
217
+
218
+ ## 0.5.0 (2013-10-17)
219
+
220
+ - Allow setting static ip addresses using Vagrant private networks
221
+ - Allow cloning from VM or template
222
+
223
+ ## 0.4.0
224
+
225
+ - Add support for specifying datastore location for new VMs
226
+
227
+ ## 0.3.0
228
+
229
+ - Lock Nokogiri version at 1.5.10 to prevent library conflicts
230
+ - Add support for customization specs
231
+
232
+ ## 0.2.0
233
+
234
+ - Add halt action
235
+ ([#16 catharsis:haltaction](https://github.com/nsidc/vagrant-vsphere/pull/16))
236
+
237
+ ## 0.1.0
238
+
239
+ - Add folder syncing with guest OS
240
+ - Add provisioning
241
+
242
+ ## 0.0.1
243
+
244
+ - Initial release
data/DEVELOPMENT.md ADDED
@@ -0,0 +1,67 @@
1
+ ### Contributing
2
+
3
+ 1. Fork it
4
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
5
+ 3. Commit your RuboCop-compliant and test-passing changes (`git commit -am 'Add
6
+ some feature'`)
7
+ 4. Push to the branch (`git push origin my-new-feature`)
8
+ 5. Create new Pull Request
9
+
10
+ ### Versioning
11
+
12
+ This plugin follows the principles of
13
+ [Semantic Versioning 2.0.0](http://semver.org/).
14
+
15
+ ### Unit Tests
16
+
17
+ Please run the unit tests to verify your changes. To do this simply run `rake`.
18
+ If you want a quick merge, write a spec that fails before your changes are
19
+ applied and that passes after.
20
+
21
+ If you don't have rake installed, first install [bundler](http://bundler.io/)
22
+ and run `bundle install`. Then you can run `bundle exec rake`, even if rake is
23
+ still not installed to your `PATH`.
24
+
25
+ ### RuboCop
26
+
27
+ Please make changes [RuboCop](https://github.com/bbatsov/rubocop)-compliant.
28
+
29
+ Changes that eliminate rules from
30
+ [`.rubocop_todo.yml`](https://github.com/nsidc/vagrant-vsphere/blob/master/.rubocop_todo.yml)
31
+ are welcome.
32
+
33
+ ### Travis-CI
34
+
35
+ [Travis](https://travis-ci.org/nsidc/vagrant-vsphere) will automatically run
36
+ RuboCop and the unit tests when you create a new pull request. If there are any
37
+ failures, a notification will appear on the pull request. To update your pull
38
+ request, simply create a new commit on the branch that fixes the failures, and
39
+ push to the branch.
40
+
41
+ ### Development Without Building the Plugin
42
+
43
+ To test your changes when developing the plugin, you have two main
44
+ options. First, you can build and install the plugin from source every time you
45
+ make a change:
46
+
47
+ 1. Make changes
48
+ 2. `rake build`
49
+ 3. `vagrant plugin install ./pkg/vagrant-vsphere-$VERSION.gem`
50
+ 4. `vagrant up --provider=vsphere`
51
+
52
+ Second, you can use Bundler and the Vagrant gem to execute vagrant commands,
53
+ saving time as you never have to wait for the plugin to build and install:
54
+
55
+ 1. Make changes
56
+ 2. `bundle exec vagrant up --provider=vsphere`
57
+
58
+ This method uses the version of Vagrant specified in
59
+ [`Gemfile`](https://github.com/nsidc/vagrant-vsphere/blob/master/Gemfile). It
60
+ will also cause Bundler and Vagrant to output warnings every time you run
61
+ `bundle exec vagrant`, because `Gemfile` lists **vagrant-vsphere** twice (once
62
+ with `gemspec` and another time in the `group :plugins` block), and Vagrant
63
+ prefers to be run from the official installer rather than through the gem.
64
+
65
+ Despite those warning messages, this is the
66
+ [officially recommended](https://docs.vagrantup.com/v2/plugins/development-basics.html)
67
+ method for Vagrant plugin development.