vagrant-vsphere 1.4.1 → 1.5.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: f54f587a665afb29a5f6726a37de604ddb2b60cb
4
- data.tar.gz: 249039db27a02d5674624bb6d7edea936ce49b29
3
+ metadata.gz: bde84889640454ab4fc3e756f28c8d1c949c70bf
4
+ data.tar.gz: 0268d91280e5ce182635227087062b0b53ecddf0
5
5
  SHA512:
6
- metadata.gz: d02f2cacb9fa863829bac9a1125762f184f9f60251c58014d813b71f7ad4f574ee0b134a5a92cb9625d05112c9d15bdfe8243b03c889edc3e01a6d953a8e3e60
7
- data.tar.gz: 84f303e78485dbf9a12546c0059e15828717b86969deb096f87c4560c2e24c2a8b9d0be9e2bbaa4af12bf56a55aa0f6515dbd18a4ac6e4cab773028b64d0ab92
6
+ metadata.gz: 35828ef6c5a0e9f2f76f6d962d2f3108656cd1e303e05cc563686d1c178fd38148e9b2e756f7e4f6fcda032dd63d149f15feb3507f3af0d3fefdc6b5319b3446
7
+ data.tar.gz: 98e6c963cee7eecb7ecaac8650ee97783b4e050cbbedfb8ad839726149feb42dde3e432c440c735aec2b5482d4fa5b7dc9027a1738d42689a7a0fcccb09e861b
data/.bumpversion.cfg CHANGED
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 1.4.1
2
+ current_version = 1.5.0
3
3
  tag = true
4
4
  commit = true
5
5
 
data/.rubocop_todo.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2015-07-21 12:35:10 -0600 using RuboCop version 0.32.1.
2
+ # on 2015-09-02 10:38:06 -0600 using RuboCop version 0.32.1.
3
3
  # The point is for the user to remove these configuration records
4
4
  # one by one as the offenses are removed from the code base.
5
5
  # Note that changes in the inspected code, or installation of new
@@ -11,18 +11,18 @@ Lint/NonLocalExitFromIterator:
11
11
 
12
12
  # Offense count: 11
13
13
  Metrics/AbcSize:
14
- Max: 117
14
+ Max: 120
15
15
 
16
16
  # Offense count: 1
17
17
  # Configuration parameters: CountComments.
18
18
  Metrics/ClassLength:
19
- Max: 166
19
+ Max: 169
20
20
 
21
21
  # Offense count: 3
22
22
  Metrics/CyclomaticComplexity:
23
23
  Max: 18
24
24
 
25
- # Offense count: 106
25
+ # Offense count: 108
26
26
  # Configuration parameters: AllowURI, URISchemes.
27
27
  Metrics/LineLength:
28
28
  Max: 177
@@ -30,7 +30,7 @@ Metrics/LineLength:
30
30
  # Offense count: 12
31
31
  # Configuration parameters: CountComments.
32
32
  Metrics/MethodLength:
33
- Max: 57
33
+ Max: 60
34
34
 
35
35
  # Offense count: 1
36
36
  # Configuration parameters: CountComments.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
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
+
1
6
  ## [1.4.1 (2015-09-01)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.4.1)
2
7
 
3
8
  - Update dependency on [rbvmomi](https://github.com/vmware/rbvmomi) to 1.8.2
data/README.md CHANGED
@@ -19,9 +19,9 @@ This provider is built on top of the
19
19
  * libxml2, libxml2-dev, libxslt, libxslt-dev
20
20
 
21
21
  ## Current Version
22
- **version: 1.4.1**
22
+ **version: 1.5.0**
23
23
 
24
- vagrant-vsphere (**version: 1.4.1**) is available from
24
+ vagrant-vsphere (**version: 1.5.0**) is available from
25
25
  [RubyGems.org](https://rubygems.org/gems/vagrant-vsphere)
26
26
 
27
27
  ## Installation
@@ -135,6 +135,11 @@ This provider has the following settings, all are required unless noted:
135
135
  * `mem_reservation` - _Optional_ Configure the memory (in MB) to reserve for this VM
136
136
  * `addressType` - _Optional_ Configure the address type of the
137
137
  [vSphere Virtual Ethernet Card](https://www.vmware.com/support/developer/vc-sdk/visdk2xpubs/ReferenceGuide/vim.vm.device.VirtualEthernetCard.html)
138
+ * `custom_attribute` - _Optional_ Add a
139
+ [custom attribute](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAAahUKEwiWwbWX59jHAhVBC5IKHa3HAEU&url=http%3A%2F%2Fpubs.vmware.com%2Fvsphere-51%2Ftopic%2Fcom.vmware.vsphere.vcenterhost.doc%2FGUID-25244732-D473-4857-A471-579257B6D95F.html&usg=AFQjCNGTSl4cauFrflUJpBeTBb0Yv7R13g&sig2=a9he6W2qVvBSZ5lCiXnENA)
140
+ to the VM upon creation. This method takes a key/value pair,
141
+ e.g. `vsphere.custom_attribute('timestamp', Time.now.to_s)`, and may be called
142
+ multiple times to set different attributes.
138
143
 
139
144
  ### Cloning from a VM rather than a template
140
145
 
@@ -180,9 +185,9 @@ config.vm.network 'private_network', ip: '192.168.50.4'
180
185
  ```
181
186
 
182
187
  The IP address will only be set if a customization spec name is given. The
183
- customization spec must have network adapter settings configured with a static
184
- IP address(just an unused address NOT the address you want the VM to be). The
185
- config.vm.network line will overwrite the ip in the customization spec with the one you set.
188
+ customization spec must have network adapter settings configured with a static
189
+ IP address(just an unused address NOT the address you want the VM to be). The
190
+ config.vm.network line will overwrite the ip in the customization spec with the one you set.
186
191
  For each private network specified, there needs to be a corresponding network adapter in
187
192
  the customization spec. An error will be thrown if there are more networks than
188
193
  adapters.
@@ -212,7 +217,7 @@ vsphere.addressType = 'Manual'
212
217
  ### Setting the MAC address
213
218
 
214
219
  To set a static MAC address, add a `vsphere.mac` to your `Vagrantfile`.
215
- In some cases you must also set `vsphere.addressType` (see above)
220
+ In some cases you must also set `vsphere.addressType` (see above)
216
221
  to make this work:
217
222
 
218
223
  ```ruby
@@ -230,7 +235,7 @@ ESXi is not supported. Make sure to connect to a vCenter server and not directly
230
235
  ### Permissions
231
236
  If you have permission issues:
232
237
 
233
- 1. give the connecting user read only access to everything, and full permission to a specific data center. Narrow the permissions down after a VM is created.
238
+ 1. give the connecting user read only access to everything, and full permission to a specific data center. Narrow the permissions down after a VM is created.
234
239
  2. Be sure the path to the VM is correct. see the "Template_Name" screenshots above for more information.
235
240
 
236
241
  ## Example Usage
@@ -259,6 +264,8 @@ Vagrant.configure("2") do |config|
259
264
  vsphere.user = 'vagrant-user@vsphere'
260
265
  vsphere.password = '***************'
261
266
  vsphere.insecure = true
267
+
268
+ vsphere.custom_attribute('timestamp', Time.now.to_s)
262
269
  end
263
270
  end
264
271
  ```
@@ -77,6 +77,10 @@ module VagrantPlugins
77
77
  env[:ui].info " -- Target VM: #{vm_base_folder.pretty_path}/#{name}"
78
78
 
79
79
  new_vm = template.CloneVM_Task(folder: vm_base_folder, name: name, spec: spec).wait_for_completion
80
+
81
+ config.custom_attributes.each do |k, v|
82
+ new_vm.setCustomValue(key: k, value: v)
83
+ end
80
84
  end
81
85
  rescue Errors::VSphereError
82
86
  raise
@@ -27,6 +27,16 @@ module VagrantPlugins
27
27
  attr_accessor :cpu_reservation
28
28
  attr_accessor :mem_reservation
29
29
 
30
+ attr_reader :custom_attributes
31
+
32
+ def initialize
33
+ @custom_attributes = {}
34
+ end
35
+
36
+ def custom_attribute(key, value)
37
+ @custom_attributes[key.to_sym] = value
38
+ end
39
+
30
40
  def validate(machine)
31
41
  errors = _detected_errors
32
42
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VSphere
3
- VERSION = '1.4.1'
3
+ VERSION = '1.5.0'
4
4
  end
5
5
  end
data/spec/spec_helper.rb CHANGED
@@ -58,7 +58,8 @@ RSpec.configure do |config|
58
58
  mac: nil,
59
59
  addressType: nil,
60
60
  cpu_reservation: nil,
61
- mem_reservation: nil)
61
+ mem_reservation: nil,
62
+ custom_attributes: {})
62
63
  vm_config = double(
63
64
  vm: double('config_vm',
64
65
  box: nil,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Grauch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri