VMWare VM IP address in service bundle from a service dialog

I’m trying to create a service bundle consisting of two catalog items which are VMWare VMs. I’m using customization specification for setting up an IP address during a provisioning process. If I provision the VM using standard provisioning procedure through provider the IP address gets properly configured.

The problem is, how can I propagate the IP address from a dialog to a customization spec? I’m trying this with miq_request_task.set_nic_settings which does not return any error during service provisioning but the resulting VMs do not have the IP configured.

miq_request_task.set_nic_settings(1, {:ip_addr=>$evm.root[‘dialog_web_ip_1’], :subnet_mask=>‘’, :gateway=>‘’, :addr_mode=>[“static”, “Static”] } )

Also, the $evm.root[‘miq_provision’] variable is empty.

Anybody can help me out with that?

All the best,

Following code actually works. Important is the idx (index) number, the first argument of the set_nic_settings function. It needs to be set to zero for the first default NIC defined in catalog item request details:

miq_request = $evm.root['service_template_provision_task'].miq_request

miq_request.miq_request_tasks.each do |miq_request_task|
  if miq_request_task.type == "ManageIQ::Providers::Vmware::InfraManager::Provision"  
    miq_request_task.set_customization_spec(name="CloudForms_customization", override=true)
    miq_request_task.set_nic_settings(0, {:ip_addr=> serviceDialogIP, :subnet_mask=>'', :gateway=>'', :addr_mode=>["static", "Static"] } )

I’ve used this method in a catalog item’s customized provisioning StateMachine (CatalogItemInitialization).