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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7085ec77febee812284fdba85d1002f2f1d6bae3ee1e02a7f264efb761217a30
4
- data.tar.gz: df5e365f5821f623f7d8328ed7381ad710d9a62534970102fce3a4600195917b
3
+ metadata.gz: f3fb477d8c5d39ca1340bb9593fbbbfcd54d3fceb477f6aeb996f92bd0c62897
4
+ data.tar.gz: fe45e70e975a4a26e87f92c3ce46d844993c954bfcd41c9dc9808229aadb1ec2
5
5
  SHA512:
6
- metadata.gz: 744634197d4ba4c19fb461226f42afbbca219e77054829ba5cb3a7a2b1b7cd10c29d94a3bb1416b840b04dc26bd5a6ba3a1dffa2827c3af9009f9f67130a3eb3
7
- data.tar.gz: 389178a1c61df997e790cc06cbb3a3d5ae7aa7d6303e946f5cf8ef7499fe65003a6419d7f1a120d6c0da99d3f524b68cdf4dae6e1ee2beab5929a2d47ae5f945
6
+ metadata.gz: fe27bc6dc42e1ccfbcb8593281337b8aa5f7c20eae4c7a66a63887daef0d6be6d31ce82ef82e91cc90cf9e297ea3a096999ed00801737919879341e623d489c8
7
+ data.tar.gz: cf02a3623872e75f65bbe7a106ed616bf50f705fcbf39bdd36d7d5c4c88a2335f872075ce88736df4587536c2dccce09a3feeff3d8431cf9091dc329e829638b
@@ -20,5 +20,5 @@
20
20
  # The main kitchen-vcenter module
21
21
  module KitchenVcenter
22
22
  # The version of this version of test-kitchen we assume enterprises want.
23
- VERSION = "2.7.12"
23
+ VERSION = "2.8.0"
24
24
  end
@@ -440,18 +440,36 @@ class Support
440
440
  return false
441
441
  end
442
442
 
443
- unless ip?(options[:guest_customization][:ip_address])
444
- raise Support::CloneError.new("Guest customization error: ip_address is required to be formatted as an IPv4 address")
445
- end
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
- unless ip?(options[:guest_customization][:subnet_mask])
448
- raise Support::CloneError.new("Guest customization error: subnet_mask is required to be formatted as an IPv4 address")
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].each do |v|
452
- unless ip?(v)
453
- raise Support::CloneError.new("Guest customization error: gateway is required to be formatted as an IPv4 address")
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
- elsif !options[:guest_customization][:gateway].is_a?(Array)
472
- raise Support::CloneError.new("Guest customization error: gateway must be an array")
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: RbVmomi::VIM::CustomizationIPSettings.new(
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.7.12
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-08-21 00:00:00.000000000 Z
11
+ date: 2020-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbvmomi