7.1

Table Of Contents
Table 434. Scripting Examples for the Computed Property Option
Sample String Property Script Sytax Sample Usage
my_unique_id = ""
Bash - $my_unique_id export
my_unique_id="012345678
9"
Windows CMD - %my_unique_id% set
my_unique_id=0123456789
Windows PowerShell - $my_unique_id $my_unique_id =
"0123456789"
String Property
String properties expect string values. You can supply the string yourself, require someone else to supply
the value, or retrieve the value from another blueprint component by creating a binding to another string
property. String values can contain any ASCII characters. To create a property binding, use the Properties
tab on the design canvas to select the appropriate property for binding. The property value is then passed to
the action scripts as raw string data. When you bind to a blueprint string property, make sure the blueprint
component you bind to is not clusterable. If the component is clustered, the string value becomes an array
and you do not retrieve the value you expect.
Sample String Property Script Syntax Sample Usage
admin_email = "admin@email987.com"
Bash - $admin_email echo $admin_email
Windows CMD - %admin_email% echo %admin_email%
Windows PowerShell - $admin_email write-output $admin_email
Array Property
Array properties expect an array of string, integer, decimal, or boolean values dened as [“value1”, “value2”,
“value3”…]. You can supply the values yourself, require someone else to supply the values, or retrieve the
values from another blueprint component by creating a property binding. When you dene values for an
array property you must enclose the array in square brackets. For an array of strings, the value in the array
elements can contain any ASCIl characters. To properly encode a backslash character in an Array property
value, add an extra backslash, for example, ["c:\\test1\\test2"]. For a bound property, use the Properties
tab in the blueprint canvas to select the appropriate property for binding. If you bind to an array, you must
design your software components so they don't expect a value array in any specic order.
For example, consider a load balancer virtual machine that is balancing the load for a cluster of application
server virtual machines. In such a case, an array property is dened for the load balancer service and set to
the array of IP addresses of the application server virtual machines.
These load balancer service congure scripts use the array property to congure the appropriate load
balancing scheme on the Red Hat, Windows, and Ubuntu operating systems.
Sample Array Property Script Syntax Sample Usage
operating_systems = ["Red
Hat","Windows","Ubuntu"]
Bash - ${operating_systems[@]}
for the entire array of strings
${operating_systems[N]}
for the individual array element
for (( i = 0 ; i < $
{#operating_systems[@]}; i++ )); do
echo ${operating_systems[$i]}
done
Windows CMD - %operating_systems_N
%
where N represents the position of the
element in the array
for /F "delims== tokens=2" %%A in
('set operating_systems_') do (
echo %%A
)
Configuring vRealize Automation
292 VMware, Inc.