How to get a vRO node name in a workflow

Business Requirement:

The customer has a vRO 7.6 workflow for CMDB registration. The workflow relies on the vRO node name. After migrating to the cloud proxy vRO appliance the workflow stopped working. The requirement was to update the hostname logic in a new container-based vRO.

Problem Statement:

The customer uses the below code to get the vRO node name. Based on the node name customer decided the vRO environment the workflow is executing in and pull environment-specific key-value pairs from a resource element.

var nodeName = System.resolveIpAddress("127.0.0.1");

The new cloud proxy vRO appliances are container-based, so running the above command will return localhost and doesn’t return the container (vco-app) hostname. The logic needs to be updated to get the container hostname instead of the appliance hostname.

Solution :

vRO also enables you to run the commands on the appliance and fetch the output. For the new solution, you need to set access to operating system commands for workflows and actions. Please follow the instructions on Page#74

https://docs.vmware.com/en/vRealize-Orchestrator/8.4/vrealize-orchestrator-84-install-config-guide.pdf

This will add a key-value pair “com.vmware.js.allow-local-process” : true in the vRO system properties.

The legacy code needs to be replaced with the below snippet

var com = new Command(["printenv", "|", "fgrep", "JVM_OPTS"]);
var res = com.execute(true); // makes the call blocking
var output = com.output;
var nodeName = output.match(/-Dvco.app.hostname=([^\s]+)/)[1];
System.log('vRO Hostname: ' + nodeName);

I hope this article will help the readers save some time troubleshooting and researching the solution.

Author

Barjinder Singh

Leave a Reply