VMware Cloud Community
MichaelAT
Contributor
Contributor
Jump to solution

Change Attribute - Configuration Item mapping in Scriptable Task

Hi,

is it possible to change the mapping of attributes to configuration items with a scriptable tasks?

Or do I have to map all possible configuration items to attributes to decide later which one to use?

example:

configuration 1:

cpus=4

memory=8

disk_size=16

configuration 2:

cpus=2

memory=4

disk_size=8

Is it possible to have only three attributes (cpus, memory, disk_size) and map either configuration 1 or configuration 2 via scriptable task?

Or do I need 6 attributes (cpus1, cpus2, memory1, memory2, disk1, disk2) do a static mapping and use three of six possible attributes?

Thanks,

Michael

Reply
0 Kudos
1 Solution

Accepted Solutions
Dan_Linsley
VMware Employee
VMware Employee
Jump to solution

The way I've seen this done is as follows:

Set a ConfigurationElement (named configElement in the example below) as an attribute to your workflow.

Create items in the ConfigurationElement that are prefixed with your size or configuration. (Ex: small_cpu, large_cpu, small_memory, large_memory, etc).

In your scriptable task:

var cpuAttr = configElement.getAttributeWithKey(size+"_cpu");

var cpu = cpuAttr.value;

var memoryAttr = configElement.getAttributeWithKey(size+"_memory");

var memory = memoryAttr.value;

View solution in original post

Reply
0 Kudos
2 Replies
Dan_Linsley
VMware Employee
VMware Employee
Jump to solution

The way I've seen this done is as follows:

Set a ConfigurationElement (named configElement in the example below) as an attribute to your workflow.

Create items in the ConfigurationElement that are prefixed with your size or configuration. (Ex: small_cpu, large_cpu, small_memory, large_memory, etc).

In your scriptable task:

var cpuAttr = configElement.getAttributeWithKey(size+"_cpu");

var cpu = cpuAttr.value;

var memoryAttr = configElement.getAttributeWithKey(size+"_memory");

var memory = memoryAttr.value;

Reply
0 Kudos
MichaelAT
Contributor
Contributor
Jump to solution

Hi,

thanks!

Regards,

Michael

Reply
0 Kudos