Highlighted
Contributor
Contributor

Determining vCloud Director initiating organisation at Presentation level (Started from vCD - Service Library)

Hi all,

We are building vCD Workflows for our Tenants at our vCD 9.5 environment which they can launch from the ‘Service Library’ of vCD.

In this workflows we want the user to select one of their Virtual Machine at the Presentation layer to perform some modifications.

Before we can collect the Tenants virtual machines and return them to a dropdown box at presentation layer, we of course need to know which Tenant initiated the workflow.

We have found the snippet “System.getContext().getParameter("_vcd_orgName")”, but this only works in the workflow itself.

This code is just returning ‘null’ from the presentation level when we execute this code within an action.

How can we retrieve the initiated orgName in an vRO action script which is building an field of type ‘Predefined list of elements’?  

Our environment versions:

vCD: 9.5.0.11038232

vRO: 7.5.0.10044239
vRO vCD Plugin: 9.5.0.10198325

0 Kudos
12 Replies
Highlighted
VMware Employee
VMware Employee

Hi,

As far as I know, context is available only during workflow execution, not during presentation execution (which happens before the workflow execution).

What API is 'Service Library' using to launch a workflow?

0 Kudos
Highlighted
VMware Employee
VMware Employee

Yes, in 9.5 the context that contains all the tenant information is only available once the workflow has been triggered, but not yet in the presentation phase.

What exactly do you want to achieve? I guess filtering input parameters for objects that "belong" to the tenant?

Joerg

www.vcoportal.de - Orchestrate. Your Cloud.
0 Kudos
Highlighted
Contributor
Contributor

Yes, I want to filter input based on the tenant who's starting the workflow.

We now ask at the presentation layer the tenant who he is and check that later in the (executing) workflow, that's not very userfriendly and secure.

Is there another way to accomplish this goal?

Thanks in advance for your replies.

Jitse

0 Kudos
Highlighted
Contributor
Contributor

When I execute a Workflow from the Service Library I see the following requests:

Request URL: https://[VCLOUD-URL]/cloudapi/workflows/urn%3Avcloud%3AserviceItem%3A[WORKFLOW-ID]/presentation

Request Method: GET

Status Code: 200 OK

Request URL: https://[VCLOUD-URL]/cloudapi/workflows/urn%3Avcloud%3AserviceItem%3A[WORKFLOW-ID]/presentation/inst...

Request Method: POST

Status Code: 200 OK

Request URL: https://[VCLOUD-URL]/cloudapi/workflows/urn:vcloud:serviceItem:[WORKFLOW-ID]/presentation/instances/...

Request Method: PUT

Status Code: 200 OK

Request URL: https://[VCLOUD-URL]/api/query?links=true&type=task&page=1&pageSize=50&filter=startDate=gt=YYYY-MM-D...

Request Method: GET

Status Code: 200 OK

In all requests I can see the Referer which is containing the tenant name:

Referer: https://[VCLOUD-URL]/tenant/[TENANT-ORGNAME]/libraries/service-items

Is it possible to collect this referer field somehow? Of some other way to collect the tenant name?

0 Kudos
Highlighted
VMware Employee
VMware Employee

Unfortunately not in the current (9.5) version of vCD.

But we plan to add this (very important) functionality in future.

Joerg

www.vcoportal.de - Orchestrate. Your Cloud.
0 Kudos
Highlighted
Contributor
Contributor

Hi Joerg,

Thanks for your reaction.

Your reaction looks like you're close to the development team of VMware vCD.

Do you know when this feature will be introduced (date or version?)

Thanks in advance.

Kind Regards,

Jitse

0 Kudos
Highlighted
VMware Employee
VMware Employee

Hi, tschoergez!

Is it fixed in vCD 9.7?

Any ETA? Any ideas?

Thanks!

Kirill

0 Kudos
Highlighted
Expert
Expert

When the action runs it should have *some* sort of execution context.

What do you get if you do this in the body of the relevant action?

System.log("Action runs as " + Server.getRunningUser());

It would be an extremely DIRTY HACK but it might give you something useful to tie back to a tenant ID/name?

0 Kudos
Highlighted
Contributor
Contributor

It seems this challenge is still present in VCD 9.7.

I tried the System.log("Action runs as " + Server.getRunningUser()); call but this behaviour is strange. It is returning another user, I think probably the user who created the org, so cant use this to work back to get the org name (in my case)

Has anyone else worked around this yet?

0 Kudos
Highlighted
Contributor
Contributor

WIth the help of Joerg from VMware I have found a solution to this. You need to specify input parameters on the workflow with specific names to get this info from VCD. You can hide these fields to keep your presentation neat. The inputs are simple strings with the specific names as below:

_vcd_orgName

_vcd_userName

_vcd_orgId

_vcd_sessionToken

_vcd_isAdmin

_vcd_apiEndpoint

0 Kudos
Highlighted
Enthusiast
Enthusiast

See also Manage Independent Disks | vCloud Director Extensibility | Partner Experience Days

Additional to written above you also have to create a data binding to "#_vcd_orgID" (example). You can hide this fields and use them in dropdown list actions

pastedImage_1.png

pastedImage_2.png

0 Kudos
Highlighted
VMware Employee
VMware Employee

I need to do something almost equal.

Could you share your workflow? May be is not exactly the same but I could start with something. I hope you could share only this workflow with the dropdown box.

I need the user (provider admin only) could select some Orgs from a Dropdown (even a multiple list).

Thank you.

0 Kudos