diff --git a/app/models/manageiq/providers/vmware/infra_manager/provision/customization.rb b/app/models/manageiq/providers/vmware/infra_manager/provision/customization.rb index 642471a64..7f9e14c6e 100644 --- a/app/models/manageiq/providers/vmware/infra_manager/provision/customization.rb +++ b/app/models/manageiq/providers/vmware/infra_manager/provision/customization.rb @@ -110,8 +110,11 @@ def collect_nic_settings nics = Array.wrap(options[:nic_settings]) nic = nics[0] nic = {} if nic.blank? - [:dns_domain, :dns_servers, :sysprep_netbios_mode, :wins_servers, :addr_mode, - :gateway, :subnet_mask, :ip_addr].each { |key| nic[key] = options[key] } + + %i[dns_domain dns_servers sysprep_netbios_mode wins_servers addr_mode gateway subnet_mask ip_addr].each do |key| + nic[key] ||= options[key] if options.key?(key) + end + nics[0] = nic options[:nic_settings] = nics diff --git a/spec/models/manageiq/providers/vmware/infra_manager/provision/customization_spec.rb b/spec/models/manageiq/providers/vmware/infra_manager/provision/customization_spec.rb index 7d2615235..b1682c6d9 100644 --- a/spec/models/manageiq/providers/vmware/infra_manager/provision/customization_spec.rb +++ b/spec/models/manageiq/providers/vmware/infra_manager/provision/customization_spec.rb @@ -160,7 +160,6 @@ options[:sysprep_full_name] = 'sysprep_full_name_value' options[:sysprep_organization] = 'sysprep_organization_value' options[:requested_network_adapter_count] = 2 - options[:ip_addr] = "192.168.1.10" # NOTE: Shouldn't have to set nic_settings and ip_addr options[:nic_settings] = [{:ip_addr => "192.168.1.10"}, {:ip_addr => "192.168.2.10"}] expect(prov_vm).not_to receive(:load_customization_spec)