vRealize Orchestrator Custom Code Counter

vRealize Orchestrator Custom Code Counter

Count lines of code/characters written in vRO.

Compatibility

The current iteration of the tool was developed and tested against vRealize Orchestrator versions 7.6, 7.5, and 7.4. It is possible that it may be compatible with some older versions as well. If using an older version, you may not be able to use the feature that gathers the presentation information depending on whether or not the vRO REST API included the call I am using to gather the workflow content. At some point, I hope to test it with vRO 8.1+ as well.

Usage Instructions

Counting Custom Code in vRealize Orchestrator


Sign in to be able to add comments.

Comments 1


4175564474 11 months ago
Hi, great script!

I've just tried it on embedded vRO in vRealize Automation 8.1, and while the script works (I haven't tested it thoroughly yet, but the figures seem to be right), there are 2 issues:

1) regardless of the vRA/vRO version, if the linked workflow is missing, it will fail with the following error:
ERROR(com.vbombarded.codecounter/analyzeWorkflows) Error in (Dynamic Script Module name : analyzeWorkflows#63) TypeError: Cannot read property "name" from null

You have implemented validation against action and modules, but no validation for missing workflows. So I' wrapped the following code (lines 62-69):
report.workflows[workflowIndex].elements[workflowItemIndex].type = "workflowElement";
report.workflows[workflowIndex].elements[workflowItemIndex].linkedWorkflow = {
"name":item.linkedWorkflow.name,
"description":item.linkedWorkflow.description,
"id":item.linkedWorkflow.id
}
report = addWorkflowIdToBeCollected(item.linkedWorkflow,report,verboseLogging);

with an IF-ELSE statement:
if ( !item.linkedWorkflow ) {
System.warn("Linked workflow not found: " + item.name + ", linked workflow will not be included.");
}
else {
report.workflows[workflowIndex].elements[workflowItemIndex].type = "workflowElement";
report.workflows[workflowIndex].elements[workflowItemIndex].linkedWorkflow = {
"name":item.linkedWorkflow.name,
"description":item.linkedWorkflow.description,
"id":item.linkedWorkflow.id
}
report = addWorkflowIdToBeCollected(item.linkedWorkflow,report,verboseLogging);
}


2) The JSON output seems to be OK, but the file download does not work, which is, I guess, a bug of an "improved" vRO 8 UI.

Anyway, the script is great, thanks for sharing.


Best regards,
Matko.