Hello,
at the moment I'm working on a workflow that provides a virtual machine, either from scratch or from template.
I want to do a selection of all templates (virtual machines) that contains "_Template".
I created a input parameter as a list of predefined elements using the action "GetAllVM'sMatchingRegexp"
So that is how it looks at the moment:
GetAction("com.vmware.library.vc.vm","getAllVMsMatchingRegexp").call( "(.*Template/ig)" )
But no results are shown. Maybe some can help me out with that?
Thanks and regards,
weda
Hi,
I would suggest to duplicate the existing getAllVMsMatchingRegexp action to, let's say, getAllVMsMatchingRegexp2, and make a small modification to its scripting code to look like the following
// Get all Virtual Machines for all vCenter connections defined for this plugin
var allVms = VcPlugin.getAllVirtualMachines();
var vms = new Array();
// Check if the VM match the regexp
for (var i in allVms) {
if (allVms[i].name.match(new RegExp(regexp, "gi"))) { // here is the only difference from the old action
vms.push(allVms[i]);
}
}
return vms;
Then, modify the list of predefined elements to use it
GetAction("com.vmware.library.vc.vm","getAllVMsMatchingRegexp2").call( "Template$" ) // will match the names ending with 'Template'
Hi,
I would suggest to duplicate the existing getAllVMsMatchingRegexp action to, let's say, getAllVMsMatchingRegexp2, and make a small modification to its scripting code to look like the following
// Get all Virtual Machines for all vCenter connections defined for this plugin
var allVms = VcPlugin.getAllVirtualMachines();
var vms = new Array();
// Check if the VM match the regexp
for (var i in allVms) {
if (allVms[i].name.match(new RegExp(regexp, "gi"))) { // here is the only difference from the old action
vms.push(allVms[i]);
}
}
return vms;
Then, modify the list of predefined elements to use it
GetAction("com.vmware.library.vc.vm","getAllVMsMatchingRegexp2").call( "Template$" ) // will match the names ending with 'Template'
Hi llian,
that was the trick, thanks alot.