VMware Cloud Community
FTVDaniel
Contributor
Contributor

automaticaly create a configurationElement attribute of type array of type

Hello

I have quite finished my Configuration Element automatisation with

Server.createConfigurationElement(category,name)

I am able to add attributes with

newElementCat.setAttributeWithKey(attrbname,attrbvalue);

but I can not find a solution to create a category of type array/ClusterComputeRessourse

the actions I found permit to update an array attribute but not to create one

does someone have a solution ?

0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee

Actually, you can create array attributes. Here is a sample that will create a new configuration element attribute containing array with all available clusters of type VC:ClusterComputeResource (myConfigElement is your configuration element to which you want to add/modify an attribute).

var allClusters = VcPlugin.getAllClusterComputeResources();

myConfigElement.setAttributeWithKey("clusters", allClusters);

Now, the problem is that the newly created attribute will not be of type Array/VC:ClusterComputeResource, but of generic array type Array. This is partly because of the type-less nature of Javascript language, and partly because of the way vRO finds the best match for the type given only some value.

Note that this not prevent you from storing the clusters in this attribute. The only problem is in vRO Java client which won't be able to provide a proper UI editor for this attribute, and you won't be able to edit its valu in the UI. But the actual value will be stored in the attribute, and you'll be able to read it via scripting API.

This could be resolved in a future vRO release by either providing a new API that will allow the customer to explicitly specify attribute type name, or by trying to tweak the internal implementation code that finds the type of a given value.

0 Kudos
FTVDaniel
Contributor
Contributor

thanks for explaination as I may need to manually modify those values after creation

as a workaroud I wanted to use the deploy packages workfows to create the configuration element with all attributes pre-configured

but those workflows work on remote orchestrator servers only

so I have a question, is it possible to add my orchestrator server as a remote orchestrator server on itself?

or do  I have to call a remote workflow whitch will deploy a category element from a package in my current server?

0 Kudos
iiliev
VMware Employee
VMware Employee

I haven't tried to add a vRO server as a remote server on itself, but in theory it should work.

Another option could be to use vRO REST API, configuring itself as a REST host in HTTP-REST plug-in.

0 Kudos
matthiaseisner
Hot Shot
Hot Shot

I need to build something similar and haven't tested it, but initializing the array properly should solve the problem. Create an attribute of type Array/ClusterComputeResource and bind it as an input before using the SDK connection to get all cluster objects.

Just an idea.

0 Kudos