kitchen-vcenter 2.7.12 → 2.8.0
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/support/clone_vm.rb +41 -22
- 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: f3fb477d8c5d39ca1340bb9593fbbbfcd54d3fceb477f6aeb996f92bd0c62897
|
4
|
+
data.tar.gz: fe45e70e975a4a26e87f92c3ce46d844993c954bfcd41c9dc9808229aadb1ec2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe27bc6dc42e1ccfbcb8593281337b8aa5f7c20eae4c7a66a63887daef0d6be6d31ce82ef82e91cc90cf9e297ea3a096999ed00801737919879341e623d489c8
|
7
|
+
data.tar.gz: cf02a3623872e75f65bbe7a106ed616bf50f705fcbf39bdd36d7d5c4c88a2335f872075ce88736df4587536c2dccce09a3feeff3d8431cf9091dc329e829638b
|
data/lib/support/clone_vm.rb
CHANGED
@@ -440,18 +440,36 @@ class Support
|
|
440
440
|
return false
|
441
441
|
end
|
442
442
|
|
443
|
-
|
444
|
-
|
445
|
-
|
443
|
+
if options[:guest_customization][:ip_address]
|
444
|
+
unless ip?(options[:guest_customization][:ip_address])
|
445
|
+
raise Support::CloneError.new("Guest customization error: ip_address is required to be formatted as an IPv4 address")
|
446
|
+
end
|
446
447
|
|
447
|
-
|
448
|
-
|
448
|
+
unless options[:guest_customization][:subnet_mask]
|
449
|
+
raise Support::CloneError.new("Guest customization error: subnet_mask is required if assigning a fixed IPv4 address")
|
450
|
+
end
|
451
|
+
|
452
|
+
unless ip?(options[:guest_customization][:subnet_mask])
|
453
|
+
raise Support::CloneError.new("Guest customization error: subnet_mask is required to be formatted as an IPv4 address")
|
454
|
+
end
|
449
455
|
end
|
450
456
|
|
451
|
-
options[:guest_customization][:gateway]
|
452
|
-
unless
|
453
|
-
raise Support::CloneError.new("Guest customization error: gateway
|
457
|
+
if options[:guest_customization][:gateway]
|
458
|
+
unless options[:guest_customization][:gateway].is_a?(Array)
|
459
|
+
raise Support::CloneError.new("Guest customization error: gateway must be an array")
|
454
460
|
end
|
461
|
+
|
462
|
+
options[:guest_customization][:gateway].each do |v|
|
463
|
+
unless ip?(v)
|
464
|
+
raise Support::CloneError.new("Guest customization error: gateway is required to be formatted as an IPv4 address")
|
465
|
+
end
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
required = %i{dns_domain timezone dns_server_list dns_suffix_list}
|
470
|
+
missing = required - options[:guest_customization].keys
|
471
|
+
unless missing.empty?
|
472
|
+
raise Support::CloneError.new("Guest customization error: #{missing.join(", ")} are required to support guest customization")
|
455
473
|
end
|
456
474
|
|
457
475
|
options[:guest_customization][:dns_server_list].each do |v|
|
@@ -460,16 +478,24 @@ class Support
|
|
460
478
|
end
|
461
479
|
end
|
462
480
|
|
463
|
-
unless %i{dns_domain timezone dns_server_list dns_suffix_list ip_address gateway subnet_mask}.all? { |k| options[:guest_customization].key? k }
|
464
|
-
raise Support::CloneError.new("Guest customization error: currently all options are required to support guest customization")
|
465
|
-
end
|
466
|
-
|
467
481
|
if !options[:guest_customization][:dns_server_list].is_a?(Array)
|
468
482
|
raise Support::CloneError.new("Guest customization error: dns_server_list must be an array")
|
469
483
|
elsif !options[:guest_customization][:dns_suffix_list].is_a?(Array)
|
470
484
|
raise Support::CloneError.new("Guest customization error: dns_suffix_list must be an array")
|
471
|
-
|
472
|
-
|
485
|
+
end
|
486
|
+
|
487
|
+
if options[:guest_customization][:ip_address]
|
488
|
+
customized_ip = RbVmomi::VIM::CustomizationIPSettings.new(
|
489
|
+
ip: RbVmomi::VIM::CustomizationFixedIp(ipAddress: options[:guest_customization][:ip_address]),
|
490
|
+
gateway: options[:guest_customization][:gateway],
|
491
|
+
subnetMask: options[:guest_customization][:subnet_mask],
|
492
|
+
dnsDomain: options[:guest_customization][:dns_domain]
|
493
|
+
)
|
494
|
+
else
|
495
|
+
customized_ip = RbVmomi::VIM::CustomizationIPSettings.new(
|
496
|
+
ip: RbVmomi::VIM::CustomizationDhcpIpGenerator.new,
|
497
|
+
dnsDomain: options[:guest_customization][:dns_domain]
|
498
|
+
)
|
473
499
|
end
|
474
500
|
|
475
501
|
RbVmomi::VIM::CustomizationSpec.new(
|
@@ -486,14 +512,7 @@ class Support
|
|
486
512
|
dnsSuffixList: options[:guest_customization][:dns_suffix_list]
|
487
513
|
),
|
488
514
|
nicSettingMap: [RbVmomi::VIM::CustomizationAdapterMapping.new(
|
489
|
-
adapter:
|
490
|
-
ip: RbVmomi::VIM::CustomizationFixedIp(
|
491
|
-
ipAddress: options[:guest_customization][:ip_address]
|
492
|
-
),
|
493
|
-
gateway: options[:guest_customization][:gateway],
|
494
|
-
subnetMask: options[:guest_customization][:subnet_mask],
|
495
|
-
dnsDomain: options[:guest_customization][:dns_domain]
|
496
|
-
)
|
515
|
+
adapter: customized_ip
|
497
516
|
)]
|
498
517
|
)
|
499
518
|
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.
|
4
|
+
version: 2.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbvmomi
|