vagrant-vsphere 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bumpversion.cfg +1 -2
- data/.rubocop.yml +21 -0
- data/.rubocop_todo.yml +14 -34
- data/CHANGELOG.md +9 -0
- data/README.md +10 -5
- data/lib/vSphere/action/clone.rb +14 -0
- data/lib/vSphere/action.rb +1 -0
- data/lib/vSphere/config.rb +3 -0
- data/lib/vSphere/version.rb +1 -1
- data/spec/action_spec.rb +3 -0
- data/spec/clone_spec.rb +27 -0
- data/spec/spec_helper.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e9dc00d36f4b543b993242631e336c96bfd6c81
|
4
|
+
data.tar.gz: cba9bf33b1f3928966fa7ddd55218e74640ed1ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8f86e54afe1fc8eb3fb4532ea4c7fbe8da30bc3d2276a84680005bb33333aa70bcd272546559b87e784ca427b897ed96667541be39aacf302a08b000fa518b8
|
7
|
+
data.tar.gz: dd0a26aa3c040cd6ef21ac1826e8b21109ea55a71dacf6100d1f35954898159a1927a5a5252e3d1858717aa91335c2383d8eddae5be9ab262c0e49705e255be4
|
data/.bumpversion.cfg
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[bumpversion]
|
2
|
-
current_version = 1.
|
2
|
+
current_version = 1.7.0
|
3
3
|
tag = true
|
4
4
|
commit = true
|
5
5
|
|
@@ -8,4 +8,3 @@ commit = true
|
|
8
8
|
[bumpversion:file:README.md]
|
9
9
|
parse = version: (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
|
10
10
|
serialize = version: {major}.{minor}.{patch}
|
11
|
-
|
data/.rubocop.yml
CHANGED
@@ -11,3 +11,24 @@ Lint/RescueException:
|
|
11
11
|
# lib/vSphere/util/vim_helpers.rb to continue rescuing Exception in that
|
12
12
|
# method
|
13
13
|
- 'lib/vSphere/util/vim_helpers.rb'
|
14
|
+
|
15
|
+
Metrics/AbcSize:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Metrics/ClassLength:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Metrics/CyclomaticComplexity:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Metrics/LineLength:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Metrics/MethodLength:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Metrics/ModuleLength:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Metrics/PerceivedComplexity:
|
34
|
+
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
-
# on
|
2
|
+
# on 2016-03-08 12:12:34 -0700 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
|
@@ -9,40 +9,14 @@
|
|
9
9
|
Lint/NonLocalExitFromIterator:
|
10
10
|
Enabled: false
|
11
11
|
|
12
|
-
# Offense count:
|
13
|
-
|
14
|
-
|
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: 162
|
12
|
+
# Offense count: 24
|
13
|
+
Style/Documentation:
|
14
|
+
Enabled: false
|
39
15
|
|
40
16
|
# Offense count: 3
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# Offense count: 25
|
45
|
-
Style/Documentation:
|
17
|
+
# Cop supports --auto-correct.
|
18
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
19
|
+
Style/EmptyLinesAroundBlockBody:
|
46
20
|
Enabled: false
|
47
21
|
|
48
22
|
# Offense count: 1
|
@@ -56,7 +30,7 @@ Style/EmptyLiteral:
|
|
56
30
|
Style/FirstParameterIndentation:
|
57
31
|
Enabled: false
|
58
32
|
|
59
|
-
# Offense count:
|
33
|
+
# Offense count: 6
|
60
34
|
# Cop supports --auto-correct.
|
61
35
|
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
|
62
36
|
Style/HashSyntax:
|
@@ -74,6 +48,12 @@ Style/RegexpLiteral:
|
|
74
48
|
Style/SpaceAroundOperators:
|
75
49
|
Enabled: false
|
76
50
|
|
51
|
+
# Offense count: 1
|
52
|
+
# Cop supports --auto-correct.
|
53
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
54
|
+
Style/StringLiterals:
|
55
|
+
Enabled: false
|
56
|
+
|
77
57
|
# Offense count: 4
|
78
58
|
# Cop supports --auto-correct.
|
79
59
|
Style/SymbolLiteral:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## [1.7.0 (2016-03-14)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.7.0)
|
2
|
+
|
3
|
+
- Add support for setting guestinfo variables
|
4
|
+
([Sharpie:add-guestinfo-support](https://github.com/nsidc/vagrant-vsphere/pull/174)).
|
5
|
+
- Run provisioner cleanup when destroying VMs
|
6
|
+
([Sharpie:enable-provisioner-cleanup](https://github.com/nsidc/vagrant-vsphere/pull/176)).
|
7
|
+
- Add the ability to configure the notes on the newly cloned VM
|
8
|
+
([rylarson:feature/rylarson-add-notes](https://github.com/nsidc/vagrant-vsphere/pull/178)).
|
9
|
+
|
1
10
|
## [1.6.0 (2016-01-21)](https://github.com/nsidc/vagrant-vsphere/releases/tag/v1.6.0)
|
2
11
|
|
3
12
|
- Use Vagrant core API instead of waiting for SSH communicator, which should
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ This is a [Vagrant](http://www.vagrantup.com) 1.6.4+ plugin that adds a
|
|
6
6
|
[vSphere](http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc_50%2Fright-pane.html)
|
7
7
|
provider to Vagrant, allowing Vagrant to control and provision machines using
|
8
8
|
VMware. New machines are created from virtual machines or templates which must
|
9
|
-
be configured prior to using
|
9
|
+
be configured prior to using this provider.
|
10
10
|
|
11
11
|
This provider is built on top of the
|
12
12
|
[RbVmomi](https://github.com/vmware/rbvmomi) Ruby interface to the vSphere API.
|
@@ -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.
|
22
|
+
**version: 1.7.0**
|
23
23
|
|
24
|
-
vagrant-vsphere (**version: 1.
|
24
|
+
vagrant-vsphere (**version: 1.7.0**) is available from
|
25
25
|
[RubyGems.org](https://rubygems.org/gems/vagrant-vsphere)
|
26
26
|
|
27
27
|
## Installation
|
@@ -110,7 +110,7 @@ This provider has the following settings, all are required unless noted:
|
|
110
110
|
the template and where the new VM will be created, if not specified the first
|
111
111
|
datacenter found will be used
|
112
112
|
* `compute_resource_name` - _Required if cloning from template_ the name of the
|
113
|
-
host containing the resource pool for the new VM
|
113
|
+
host or cluster containing the resource pool for the new VM
|
114
114
|
* `resource_pool_name` - the resource pool for the new VM. If not supplied, and
|
115
115
|
cloning from a template, uses the root resource pool
|
116
116
|
* `clone_from_vm` - _Optional_ use a virtual machine instead of a template as
|
@@ -140,6 +140,11 @@ This provider has the following settings, all are required unless noted:
|
|
140
140
|
to the VM upon creation. This method takes a key/value pair,
|
141
141
|
e.g. `vsphere.custom_attribute('timestamp', Time.now.to_s)`, and may be called
|
142
142
|
multiple times to set different attributes.
|
143
|
+
* `extra_config` - _Optional_ A hash of extra configuration values to add to
|
144
|
+
the VM during creation. These are of the form `{'guestinfo.some.variable' => 'somevalue'}`,
|
145
|
+
where the key must start with `guestinfo.`. VMs with VWware Tools installed can
|
146
|
+
retrieve the value of these variables using the `vmtoolsd` command: `vmtoolsd --cmd 'info-get guestinfo.some.variable'`.
|
147
|
+
* `notes` - _Optional_ Add arbitrary notes to the VM
|
143
148
|
|
144
149
|
### Cloning from a VM rather than a template
|
145
150
|
|
@@ -201,7 +206,7 @@ executions.
|
|
201
206
|
This is useful if running Vagrant from multiple directories or if multiple
|
202
207
|
machines are defined in the Vagrantfile.
|
203
208
|
|
204
|
-
### Setting
|
209
|
+
### Setting addressType for network adapter
|
205
210
|
|
206
211
|
This sets the addressType of the network adapter, for example 'Manual' to
|
207
212
|
be able to set a manual mac address.
|
data/lib/vSphere/action/clone.rb
CHANGED
@@ -41,6 +41,8 @@ module VagrantPlugins
|
|
41
41
|
add_custom_cpu(spec, config.cpu_count) unless config.cpu_count.nil?
|
42
42
|
add_custom_cpu_reservation(spec, config.cpu_reservation) unless config.cpu_reservation.nil?
|
43
43
|
add_custom_mem_reservation(spec, config.mem_reservation) unless config.mem_reservation.nil?
|
44
|
+
add_custom_extra_config(spec, config.extra_config) unless config.extra_config.empty?
|
45
|
+
add_custom_notes(spec, config.notes) unless config.notes.nil?
|
44
46
|
|
45
47
|
if !config.clone_from_vm && ds.is_a?(RbVmomi::VIM::StoragePod)
|
46
48
|
|
@@ -233,6 +235,18 @@ module VagrantPlugins
|
|
233
235
|
def add_custom_mem_reservation(spec, mem_reservation)
|
234
236
|
spec[:config][:memoryAllocation] = RbVmomi::VIM.ResourceAllocationInfo(reservation: mem_reservation)
|
235
237
|
end
|
238
|
+
|
239
|
+
def add_custom_extra_config(spec, extra_config = {})
|
240
|
+
return if extra_config.empty?
|
241
|
+
|
242
|
+
# extraConfig must be an array of hashes with `key` and `value`
|
243
|
+
# entries.
|
244
|
+
spec[:config][:extraConfig] = extra_config.map { |k, v| { 'key' => k, 'value' => v } }
|
245
|
+
end
|
246
|
+
|
247
|
+
def add_custom_notes(spec, notes)
|
248
|
+
spec[:config][:annotation] = notes
|
249
|
+
end
|
236
250
|
end
|
237
251
|
end
|
238
252
|
end
|
data/lib/vSphere/action.rb
CHANGED
data/lib/vSphere/config.rb
CHANGED
@@ -26,11 +26,14 @@ module VagrantPlugins
|
|
26
26
|
attr_accessor :cpu_count
|
27
27
|
attr_accessor :cpu_reservation
|
28
28
|
attr_accessor :mem_reservation
|
29
|
+
attr_accessor :extra_config
|
30
|
+
attr_accessor :notes
|
29
31
|
|
30
32
|
attr_reader :custom_attributes
|
31
33
|
|
32
34
|
def initialize
|
33
35
|
@custom_attributes = {}
|
36
|
+
@extra_config = {}
|
34
37
|
end
|
35
38
|
|
36
39
|
def custom_attribute(key, value)
|
data/lib/vSphere/version.rb
CHANGED
data/spec/action_spec.rb
CHANGED
@@ -8,6 +8,9 @@ describe VagrantPlugins::VSphere::Action do
|
|
8
8
|
|
9
9
|
before :each do
|
10
10
|
@machine.stub(:id).and_return(EXISTING_UUID)
|
11
|
+
# Vagrant has some pretty buggy multi threading and their conditions
|
12
|
+
# check can fail if the wait_for_ready method returns right away
|
13
|
+
@machine.communicate.stub(:wait_for_ready) { sleep(1) }
|
11
14
|
end
|
12
15
|
|
13
16
|
describe 'up' do
|
data/spec/clone_spec.rb
CHANGED
@@ -99,4 +99,31 @@ describe VagrantPlugins::VSphere::Action::Clone do
|
|
99
99
|
config: RbVmomi::VIM.VirtualMachineConfigSpec }
|
100
100
|
)
|
101
101
|
end
|
102
|
+
|
103
|
+
it 'should set extraConfig if specified' do
|
104
|
+
@machine.provider_config.stub(:extra_config).and_return(
|
105
|
+
'guestinfo.hostname' => 'somehost.testvm')
|
106
|
+
expected_config = RbVmomi::VIM.VirtualMachineConfigSpec(extraConfig: [
|
107
|
+
{ 'key' => 'guestinfo.hostname', 'value' => 'somehost.testvm' }
|
108
|
+
])
|
109
|
+
|
110
|
+
call
|
111
|
+
expect(@template).to have_received(:CloneVM_Task).with(
|
112
|
+
folder: @data_center,
|
113
|
+
name: NAME,
|
114
|
+
spec: { location: { pool: @child_resource_pool },
|
115
|
+
config: expected_config }
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'should set custom notes when they are specified' do
|
120
|
+
@machine.provider_config.stub(:notes).and_return('custom_notes')
|
121
|
+
call
|
122
|
+
expect(@template).to have_received(:CloneVM_Task).with(
|
123
|
+
folder: @data_center,
|
124
|
+
name: NAME,
|
125
|
+
spec: { location: { pool: @child_resource_pool },
|
126
|
+
config: RbVmomi::VIM.VirtualMachineConfigSpec(annotation: 'custom_notes') }
|
127
|
+
)
|
128
|
+
end
|
102
129
|
end
|
data/spec/spec_helper.rb
CHANGED
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
|
+
version: 1.7.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: 2016-
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|