Task Name | Example on how to serach with RedEx for VM name case insensitive. |
Description | |
Prerequisites | - Tested on 6.0
|
Category | Workflow |
Components | vSphere 5.x |
User Inputs | |
Output | |
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFDX file resides. Choose the .WFDX file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment
A big thank you goes to Alejandro Madurga Ainoza for the inspiration.
The workflow:
Workflow run and input and output:
Workflow task inputs:
Custom task code:
importPackage(java.lang);
importPackage(com.cloupia.model.cIM);
importPackage(com.cloupia.lib.util.managedreports);
importPackage(com.cloupia.service.cIM.inframgr);
importPackage(com.cloupia.model.cIM);
var realvmname ='';
function getReport(reportContext, reportName){
var report = null;
try{
report = ctxt.getAPI().getConfigTableReport(reportContext, reportName);
}catch(e)
{}
if (report == null)
{
return ctxt.getAPI().getTabularReport(reportName, reportContext);
}
else {
var source = report.getSourceReport();
return ctxt.getAPI().getTabularReport (source, reportContext);
}
}
function getReportView(reportContext, reportName){
var report = getReport(reportContext, reportName);
if (report == null)
{
logger.addError("No such report exists for the specified context "+reportName);
return null;
}
return new TableView(report);
}
function accessReports(filter){
var reportName="TABULAR_REPORT_VMS_PAGINATED_CONFIG_REPORT";
var repContext = util.createContextByType( "Global",null,null);
var report = getReportView(repContext, reportName);
logger.addInfo("RowCount Before filter : " + report.rowCount());
logger.addInfo("Filtering VMs")
//
// true means reg ex filter
// Example: (?i)PRD-TU-01
// will find the vmname PRD-tu-01
//
var filtered_report = report.filterRowsByColumn("VM Name", filter, true);
logger.addInfo("Total VMs after filtering: "+ String(filtered_report.rowCount()));
var ActualVMName = filtered_report.getColumnValue(0, "VM Name");
logger.addInfo("Actual VM Name: "+ ActualVMName);
realvmname = ActualVMName;
return filtered_report.rowCount();
}
var filter = String(input.RegExFilter + input.VMName);
//var filter = "(?i)PRD-tu-01";
logger.addInfo("User Input:"+ filter)
var out = accessReports(filter);
output.VMsFound = out;
output.ActualVMName = realvmname;