I am building a workflow to deploy vms to remote sites. My workflow uses a scriptable task with the getAllVmFolders method. My issue is that my folders look like below. My clone workflow doesn't work since I can't just rely on the "getAllVmFolders()" as it doesn't allow me to filter based on the cluster it is part of.
Datacenter 1
SITE 1 CLUSTER
HOST1
HOST2
Discoverd Virtual Machines
Datacenter 2
SITE 2 CLUSTER
HOST1
HOST2
Discoverd Virtual Machines
etc
etc
**** Here's my folder "get" code with a section commented out since the .parent.name parameters aren't valid. ****
//*** WE SET A STATIC FOLDER
var folders = VcPlugin.getAllVmFolders();
var arraylength = folders.length;
var i=0;
while (i < arraylength){
if ("DISCOVERED VIRTUAL MACHINE"==folders[i].name.toUpperCase()){
System.log("FOUND FOLDER: " + folders[i].name); //Folder is found in every cluster how to I designate only "SITE1"
// System.log("Parent: " + folders[i].parent.name);
// if (folders[i].parent.name.toUpperCase() == "DISCOVERED VIRTUAL MACHINE"){
// sFolder=folders[i];
// break;
// }
}
Can anyone help?