VMware Cloud Community
RonPSSC
Enthusiast
Enthusiast
Jump to solution

Update Multiple vRA Blueprints using vRO Workflow

Am hoping someone can help me with this particular requirement. With multiple Blueprints at my disposal to manage, I often find myself having to update many (or all) with the same changes at the same time. Unfortunately, since there does not appear to be a vRO Workflow available that can handle a global change to vRA Blueprints doing so means I have to open up each Blueprint individually to apply the relevant change. 

I was able to locate a vRO Workflow that can update a single Blueprint and tried to introduce an array to capture multiple Blueprints but executing this modified workflow did not produce the desired results...i.e. the update does not get applied to any Blueprint selected in the array. Maybe my code is wrong or perhaps this can't be done.

Any help or advise will be appreciated.

Thx. Ron

Tags (1)
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

It won't work the way you implemented it. The problem is that the first parameter of the action addUpdatePropertyFromBlueprint is of type vCACCAFE:CompositeBueprint, but when your workflow calls the action, it passes to this parameter a value of type Array/vCACCAFE:CompositeBlueprint, which is not the type the action expects.

There are two ways to fix the problem:

1) Create a new action, let's say addUpdatePropertyFromBlueprintMultiple, whit the type of first parameter changed from vCACCAFE:CompositeBueprint to Array/vCACCAFE:CompositeBlueprint, and having code almost the same of the original action, wrapped in a for loop that will iterate over the values from the input array.

2) Create two new workflows. The first one will be only a wrapper to call the action addUpdatePropertyFromBlueprint. In the second one, add an input parameter of type Array/vCACCAFE:CompositeBlueprint, and then add a Foreach element that will iterate over the input array and call the first workflow. This approach will require some effort to correctly set input/output bindings.

Th efirst approach is easier but requires duplication of the scripting action. The second approach is more tricky to get right, but it avids code duplication. Let me know if you need help with it.

View solution in original post

0 Kudos
7 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Ron,

I don't see a reason why a workflow to update a single blueprint cannot be applied to a multiple blueprints in a loop. It should work if you either change the input parameter from a single blueprint to an array of blueprints, or for example use a vRO foreach element to iterate over array of blueprints.

If possible, could you export the workflows you are testing with to check why it is not working?

0 Kudos
RonPSSC
Enthusiast
Enthusiast
Jump to solution

Thx for replying, Ilian..!!

See attached, Workflow. When I execute it, the Logs indicate that there is an " Empty cafe host" but I can assure you both the "host" and "array" are accurately displayed in the Variables tab of the executed workflow.

Thx for looking into this..

Ron

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

It won't work the way you implemented it. The problem is that the first parameter of the action addUpdatePropertyFromBlueprint is of type vCACCAFE:CompositeBueprint, but when your workflow calls the action, it passes to this parameter a value of type Array/vCACCAFE:CompositeBlueprint, which is not the type the action expects.

There are two ways to fix the problem:

1) Create a new action, let's say addUpdatePropertyFromBlueprintMultiple, whit the type of first parameter changed from vCACCAFE:CompositeBueprint to Array/vCACCAFE:CompositeBlueprint, and having code almost the same of the original action, wrapped in a for loop that will iterate over the values from the input array.

2) Create two new workflows. The first one will be only a wrapper to call the action addUpdatePropertyFromBlueprint. In the second one, add an input parameter of type Array/vCACCAFE:CompositeBlueprint, and then add a Foreach element that will iterate over the input array and call the first workflow. This approach will require some effort to correctly set input/output bindings.

Th efirst approach is easier but requires duplication of the scripting action. The second approach is more tricky to get right, but it avids code duplication. Let me know if you need help with it.

0 Kudos
RonPSSC
Enthusiast
Enthusiast
Jump to solution

Hi Ilian;

I implemented Option 1 below and it appears to work!! Awesome suggestion..!! I performed a quick test and am able to successfully update/add a custom property on multiple blueprints. The only suspect area however is the Logs are still reporting "Empty cafe host".. Since I'm not a coder by trade, I'm not sure if the problem is with the original javascript or the way I'm calling the original element in my workflow.

I've attached the new Workflow c/w new Action Item based on your recommended Option 1.

If you could be so kind to have a look-see to determine if I'm looping properly and also whether I can eliminate the potentially benign Log output, that would be great..

Also, could you advise as to whether this logic can also be used to perform similar updates on vCACCAFE:AdminCatalogItem entities?

Thanks. Ron

0 Kudos
RonPSSC
Enthusiast
Enthusiast
Jump to solution

Hello again Ilian ;

Disregard my second question below on whether this logic can also be used to perform similar updates on vCACCAFE:AdminCatalogItem entities.. I mistakenly assumed that the vCACCAFE:AdminCatalogItem entities correspond to actual vSphere (vCenter) Machine items/types within a Blueprint. Not 100% certain but I don't believe there is any way to execute any type of update on vSphere Machine Types contained within a Blueprint but, again, I could be wrong. If you could confirm my suspicions that would be appreciated also.

Thx. Ron

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

I'm not familiar with vSphere machine types within a blueprint so I cannot advise you there.

As for the 'Empty cafe host' message - the new action is not correct. On its first line var cafeHost = vCACCAFEEntitiesFinder.getHostForEntity(blueprint); the parameter blueprint is an array, not a single entity, so getHostForEntity() won't return a valid host.

But it is actually not needed to invoke this action in your workflow; in the workflow, the second element (scriptable task labelled 'Update Blueprints') iterates over all the blueprints and updates them. So the workflow doesn't need its first element that calls the new action, and you can remove it from the workflow.

RonPSSC
Enthusiast
Enthusiast
Jump to solution

Interesting... basically all I needed was the 2nd element (scriptable task) which introduces a for loop in the original addUpdatePropertyFromBlueprint Action element.

Thank you, sir..!!

Ron

0 Kudos