VMware Cloud Community
istroh
Enthusiast
Enthusiast

Problems using a VclHost instance as input parameter for an embedded workflow

Hi there,

something seems to have been changed in 5.1 -- I am not longer able to pass in references to a VclHost to an embedded workflow within another workflow. It did work perfectly in Orchestrator 4.x, the problem turned up in 5.1...

Here's how to reproduce it:

Let's assume we have one VDC per organization, and we want to load this VDC given the following parameters:

- vCloud Director URL (vcdUrl)

- Org name (vcdOrg)

- Org admin username (vcdUsername)

- Org admin password (vcdPassword)

1. Create a workflow with a scriptable task which accept the four parameters above as input and sets a VclHost instance as output:


var useSamlAuthentication = false,

    maxConnections = 600,

    connectionTimeout = 30000; // timeout is in msecs

var host = VclHostManager.createHost();

host.url = vcdUrl;

host.enabled = true;

host.maxConnections = maxConnections;

host.connectionTimeout = connectionTimeout;

host.sessionMode = VclHostSessionMode.SHARED_SESSION;

host.organization = vcdOrg;

host.useSamlAuthentication = useSamlAuthentication;

host.setUsername(vcdUsername);

host.setPassword(vcdPassword);

host.login();

vcdHost = host; // set the output


2. Add a workflow element that accepts the VclHost instance (vcdHost) as input and return a VCD, the workflow itself is quiete simple, it's contains just one scriptable task that looks like this (vcdHost and vcdOrg are input parameters, vdc is the output parameter):

// we assume one single VDC per organization here

var orgObj = null;

for each (var org in vcdHost.getOrganizations()) { // <- this fails in 5.1

    // org names are case insensitive

    if (org.name.toLowerCase() == vcdOrg.toLowerCase()) {

        orgObj = org;

        break;

    }

}

if (orgObj == null) {

    throw "Could not load organization object";

}

var orgVdcs = orgObj.getVdcs();

if (!orgVdcs || orgVdcs.length == 0) {

    throw "Could not load organization VDCs";

}

vdc = orgVdcs[0];

3. Connect the task from 1. to the workflow element from 3 and run the script, formerly (on 4.x) it would return the first VDC in the passed in organization, now I get the following error: "TypeError: Cannot find function getOrganizations in object notfound." -- obviously the passed in vcdHost input parameter is for some reason turned into a "notfound" object.

4. Replace the workflow element with a scriptable task that contains exactly the same code as the single task from the worfklow in 2. and run it again -- now the vcdHost is there and the VDC is being found just fine.

So has anyone seen something similar after the upgrade to 5.1.1? The only thing that changed between 4.x and 5.1.1 is the fact that we now have SAML support, see https://communities.vmware.com/docs/DOC-20431


(*) Object VclHost

   :smileyplus: Method getServices

   :smileyplus: Method setSamlTokenCallback

   :smileyplus: Property connectionTimeout

   :smileyplus: Property samlTokenCallbackName

   :smileyplus: Property useSamlAuthentication

   :smileyminus: Property cloudVersion

Any help greatly appreciated!

Thanks,

Igor

0 Kudos
0 Replies