I recently upgraded 7.1 to 7.4 and my main job for provisioning stopped working. I was hoping someone can point me in the right direction.
Here is the error
TypeError: Cannot read property "name" from null (Workflow:Deploy VM / Clone Param Setup (item9)#31)
Here is Item 9 it's just putting out syslog on line 31
So here is that block
// Get the port group to attach to based on the ID in the IP Pool
var dvPortGroupId = MatchingIPPools[0].networkAssociation[0].network.id;
ATTR_NewVM_PortGroup = System.getModule("org.domain.www").getDvPortgroupById(dvPortGroupId,ATTR_NewVM_vCenter);
System.log("Found matching port group '" + ATTR_NewVM_PortGroup.name + "' in vCenter '" + ATTR_NewVM_vCenter + "'");
I had to reindex the logs to get log output. Here are the errors from the logs.
```
[2019-11-22 18:28:37.144] [E] Could not find a portgroup in 'DynamicWrapper (Instance) : [VcSdkConnection]-[class com.vmware.o11n.plugin.vsphere_gen.SdkConnection_Wrapper] -- VALUE : vcenter.domain.org' for id 'dvportgroup-288163'
[2019-11-22 18:28:37.146] [E] Error in (Workflow:Deploy CUIT VM / Clone Param Setup (item9)#31) TypeError: Cannot read property "name" from null
I've attached item 9 in its entierty below
I really appreciate any help
Thank you
//
// ### Determine IP pool, network parameters
//
System.log("Finding a vCenter IP pool to match to the IP address '" + ATTR_NewVM_IPAddress + "'...");
var MatchingIPPools = System.getModule("edu.columbia.cuit").getIpPoolByIp(ATTR_NewVM_IPAddress);
// There should be exactly one IP Pool returned
// It should have exactly one port group associated with it
if(MatchingIPPools.length === 0) {
throw "No IP pools corresponding to " + ATTR_NewVM_IPAddress + " were found; cannot deploy.";
} else if(MatchingIPPools.length > 1) {
throw "More than one IP pool was found that corresponds to " + ATTR_NewVM_IPAddress + "; cannot deploy.";
} else if(MatchingIPPools[0].networkAssociation.length === 0) {
throw "The identified IP pool '" + MatchingIPPools[0].name + "' does not have any port groups associated with it; cannot deploy.";
} else if(MatchingIPPools[0].networkAssociation.length > 1) {
throw "The identified IP pool '" + MatchingIPPools[0].name + "' has more than one port group associated with it; cannot deploy.";
}
// Set up the IP parameters based on this pool
ATTR_NewVM_Net_Gateway = [ MatchingIPPools[0].ipv4Config.gateway ];
System.log("Gateway array set to '" + JSON.stringify(ATTR_NewVM_Net_Gateway) + "'");
ATTR_NewVM_Net_SubnetMask = MatchingIPPools[0].ipv4Config.netmask;
System.log("Subnet mask set to '" + ATTR_NewVM_Net_SubnetMask + "'");
// Which vCenter is this going into?
ATTR_NewVM_vCenter = MatchingIPPools[0].networkAssociation[0].network.sdkConnection;
// Get the port group to attach to based on the ID in the IP Pool
var dvPortGroupId = MatchingIPPools[0].networkAssociation[0].network.id;
ATTR_NewVM_PortGroup = System.getModule("edu.columbia.cuit").getDvPortgroupById(dvPortGroupId,ATTR_NewVM_vCenter);
System.log("Found matching port group '" + ATTR_NewVM_PortGroup.name + "' in vCenter '" + ATTR_NewVM_vCenter + "'");
//
// ### Determine template
//
ATTR_NewVM_SourceTemplate = System.getModule("edu.columbia.cuit").getMostCurrentTemplateByOs(INPUT_GuestOS,ATTR_NewVM_vCenter);
// The template shouldn't be null
if(ATTR_NewVM_SourceTemplate === null) {
throw "A valid template to deploy from could not be found for '" + INPUT_GuestOS + "' in '" + ATTR_NewVM_vCenter + "'";
}
//
// ### Determine the Cluster, VM folder, and Resource Pool to deploy into
//
var ipPool = MatchingIPPools[0];
var clusterNameSearch = 'DevTest';
System.log("Searching for a cluster to deploy into with '" + clusterNameSearch + "' in its name...");
var cr = ATTR_NewVM_vCenter.getAllClusterComputeResources(['name'],'xpath:contains(name, "' + clusterNameSearch + '")');
if(cr.length > 1) {
throw "More than one '" + clusterNameSearch + "' cluster found in '" + ATTR_NewVM_vCenter + "'";
} else if(cr.length === 0) {
throw "No '" + clusterNameSearch + "' cluster found in '" + ATTR_NewVM_vCenter + "'";
} else {
ATTR_NewVM_ResourcePool = cr[0].resourcePool;
}
System.log("A target cluster was found: " + cr[0].name);
var vmFolderId = 'group-v3';
System.log("Searching for the root VM folder...");
var vmf = ATTR_NewVM_vCenter.getAllVmFolders(['name'],'xpath:id="' + vmFolderId + '"');
if(vmf.length > 1) {
throw "More than one '" + vmFolderId + "' VM folder found";
} else if(vmf.length === 0) {
throw "No '" + vmFolderId + "' folder found";
} else {
var ATTR_NewVM_Folder = vmf[0];
}
System.log("A target VM folder was found: " + ATTR_NewVM_Folder.name);
var datastoreNameSearch = '_vmdk_staging_1';
System.log("Searching for a datastore to deploy into with '" + datastoreNameSearch + "' in its name...");
var ds = ATTR_NewVM_vCenter.getAllDatastores(['name'],'xpath:contains(name,"' + datastoreNameSearch + '")');
if(ds.length > 1) {
throw "More than one '" + datastoreNameSearch + "' datastore found";
} else if(ds.length === 0) {
throw "No '" + datastoreNameSearch + "' datastore found";
} else {
ATTR_NewVM_Datastore = ds[0];
}
System.log("A target datastore was found: " + ATTR_NewVM_Datastore.name);