kitchen-vcenter 2.1.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen-vcenter/version.rb +1 -1
- data/lib/kitchen/driver/vcenter.rb +2 -0
- data/lib/support/clone_vm.rb +19 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be70461cce1a547dea1adf6f9e8d6455b1e8ac94cdc7b5fef4770dbc99e30351
|
4
|
+
data.tar.gz: 3fe4497e67f00349262f712c80d7ab9946348be345213eb69b51f484996ca39c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c2cc7a1372169dcd36e7806a51f7db5ea8b5f16402b2f7d618b4d0f137d537b6bd4d6a43b83339ebb7818315d753100eb1d424ee95c7764388c764d66a84728
|
7
|
+
data.tar.gz: 2ea80d7060c5360d35eb2e19f2e6e223a74138e3b08649f5c5594996f759ea16398485cf80c0c6d59305d14f4ff7ceac5cb51ebf93ce26209ab92956103db3b6
|
@@ -52,6 +52,7 @@ module Kitchen
|
|
52
52
|
default_config :vm_wait_interval, 2.0
|
53
53
|
default_config :vm_rollback, false
|
54
54
|
default_config :customize, nil
|
55
|
+
default_config :interface, nil
|
55
56
|
|
56
57
|
# The main create method
|
57
58
|
#
|
@@ -118,6 +119,7 @@ module Kitchen
|
|
118
119
|
resource_pool: config[:resource_pool],
|
119
120
|
clone_type: config[:clone_type],
|
120
121
|
network_name: config[:network_name],
|
122
|
+
interface: config[:interface],
|
121
123
|
wait_timeout: config[:vm_wait_timeout],
|
122
124
|
wait_interval: config[:vm_wait_interval],
|
123
125
|
customize: config[:customize],
|
data/lib/support/clone_vm.rb
CHANGED
@@ -16,10 +16,25 @@ class Support
|
|
16
16
|
def get_ip(vm)
|
17
17
|
@ip = nil
|
18
18
|
|
19
|
+
# Don't simply use vm.guest.ipAddress to allow specifying a different interface
|
19
20
|
unless vm.guest.net.empty? || !vm.guest.ipAddress
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
nics = vm.guest.net
|
22
|
+
if options[:interface]
|
23
|
+
nics.select! { |nic| nic.network == options[:interface] }
|
24
|
+
|
25
|
+
raise format("No interfaces found on VM which are attached to network '%s'", options[:interface]) if nics.empty?
|
26
|
+
end
|
27
|
+
|
28
|
+
vm_ip = nil
|
29
|
+
nics.each do |net|
|
30
|
+
vm_ip = net.ipConfig.ipAddress.detect { |addr| addr.origin != "linklayer" }
|
31
|
+
break unless vm_ip.nil?
|
32
|
+
end
|
33
|
+
|
34
|
+
extended_msg = options[:interface] ? "Network #{options[:interface]}" : ""
|
35
|
+
raise format("No valid IP found on VM %s", extended_msg) if vm_ip.nil?
|
36
|
+
|
37
|
+
@ip = vm_ip.ipAddress
|
23
38
|
end
|
24
39
|
|
25
40
|
ip
|
@@ -167,7 +182,7 @@ class Support
|
|
167
182
|
task.wait_for_completion
|
168
183
|
end
|
169
184
|
|
170
|
-
if options[:poweron] && !options[:customize].nil?
|
185
|
+
if options[:poweron] && !options[:customize].nil? && options[:clone_type] != :instant
|
171
186
|
task = vm.PowerOnVM_Task
|
172
187
|
task.wait_for_completion
|
173
188
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-vcenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbvmomi
|