Application Services supports string, array, content, computed, boolean, single select, integer, and double properties.

Note:

The names of properties are case-sensitive and can contain only alphabetic, numeric, hyphen (-), or underscore (_) characters.

String Property

The string property value can be a string or the value bound to another string property. A string value can contain any ASCII characters. For a bound property, use the Properties tab in the blueprint canvas to select the appropriate property for binding. The property value is then passed to the action scripts as raw string data.

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

BeanShell - admin_email

print(admin_email);

Array Property

The array property value can be an array of strings defined as [“value1”, “value2”, “value3”…] or the value bound to another array property. When you define values for an array property you must enclose the array of strings 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.

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 defined for the load balancer service and set to the array of IP addresses of the application server virtual machines.

These load balancer service configure scripts use the array property to configure 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
)

Windows PowerShell - $operating_systems

for the entire array of strings

$operating_systems[N]

for the individual array element

foreach ($os in $operating_systems){
   write-output  $os
}

BeanShell - operating_systems[N]

where N represents the position of the element in the array

for(index=0;index < operating_systems.length; index++) {
   print(operating_systems[index]);
}

Content Property

The content property value is a URL to a file to download content. Application Services agent downloads the content from the URL to the virtual machine and passes the location of the local file in the virtual machine to the script.

Content properties must be defined as a valid URL with the HTTP or HTTPS protocol. For example, suppose Hyperic artifacts are hosted in the Application Services appliance and the URL points to that location in the appliance. The Application Services agent downloads the artifacts from the specified location into the deployed virtual machine.

Sample String Property

Script Syntax

Sample Usage

HQ_PACKAGE = "http://DarwinServerIP/artifacts/services/hyperic/hyperic-hq-agent-linux.tar.gz"

Bash - $HQ_PACKAGE

tar -zxvf $HQ_PACKAGE

Windows CMD - %HQ_PACKAGE%

start /wait c:\unzip.exe
%HQ_PACKAGE%

Windows PowerShell - $HQ_PACKAGE

 & c:\unzip.exe
$HQ_PACKAGE

BeanShell - HQ_PACKAGE

import java.io.BufferedOutputStream;
	import java.io.File;
	import java.io.FileInputStream;
	import java.io.FileOutputStream;
	import java.util.zip.ZipEntry;
	import java.util.zip.ZipInputStream;

	destDir = new File(bsh.cwd);
            if (!destDir.exists()) {
                destDir.mkdir();
            }
            zipIn = new ZipInputStream(new FileInputStream(HQ_PACKAGE));
            entry = zipIn.getNextEntry();
            // iterates over entries in the zip file
            while (entry != null) {
                String filePath = bsh.cwd + File.separator + entry.getName();
                if (!entry.isDirectory()) {
                    // if the entry is a file, extracts it
                    bos = new BufferedOutputStream(new FileOutputStream(filePath));
                    bytesIn = new byte[4096];
                    read = 0;
                    while ((read = zipIn.read(bytesIn)) != -1) {
                        bos.write(bytesIn, 0, read);
                    }
                    bos.close();
                } else {
                    // if the entry is a directory, make the directory
                    dir = new File(filePath);
                    dir.mkdir();
                }
                zipIn.closeEntry();
                entry = zipIn.getNextEntry();
            }
            zipIn.close();

Computed Property

The computed property type does not allow an initial value when it is being defined. Instead, the computed property type takes the value from the INSTALL, CONFIGURE, or START life cycle scripts. The assigned value is propagated to the subsequent available life cycle and dependent components.

Note:

Computed properties that are defined in the action scripts are not available to the UPDATE, ROLLBACK, or TEARDOWN life cycle script. You must set the value for the computed property in the respective life cycle scripts.

Sample String Property

Script Syntax

Sample Usage

my_unique_id = ""

Bash - $my_unique_id

export my_unique_id="0123456789"

Windows CMD - %my_unique_id%

set my_unique_id=0123456789

Windows PowerShell - $my_unique_id

$my_unique_id = "0123456789"

BeanShell - my_unique_id

my_unique_id = "0123456789";

Boolean Property

The boolean property type provides Yes and No choices in the Value drop-down menu, but the value you select changes to True or False when you click on another part of the page. Application Services displays the Yes and No values to avoid confusion and provide consistency with the vRealize Automation console interface, but changes Yes to True and No to False for use in action scripts.

Single Select Property

The single select property lets you specify multiple string values from which the user can select only one value.

Integer Property

The integer property type accepts zero, a positive integer, or a negative integer as a value.

Double Property

The double property type stores floating point values with precision to four places.

Property Type Reference

Property type references show which property types you can refer to for configuration purposes.

Property Type

Property Type to Bind

Auto-Bind Expose

Auto-Bind Consume

Accept Initial Property Value

String

String, Array, Content, and Computed

Yes

Yes

Yes

Content

N/A

N/A

N/A

Yes

Array

String, Content, and Computed

N/A

Yes

Yes

Computed

N/A

Yes

N/A

N/A

Array properties can also bind to a predefined node array property all in a cluster. The all property, in a regular expression, is a method to collect all of the values for a given property in a clustered node.

For more information about binding properties, see Binding to Other Properties. To understand the Auto-Bind expose and Auto-Bind consume concepts, see Auto-Binding to Other Properties.

Example of a string property value when binding to different types of properties.

Sample Property Type

Property Type to Bind

Binding Outcome (A binds to B)

String (property A)

String (property B="Hi")

A="Hi"

String (property A)

Content (property B="http://my.com/content")

A="http://my.com/content"

String (property A)

Array (property B=["1","2"])

A="["1","2"]"

String (property A)

Computed (property B="Hello")

A="Hello"

Example of an array property value when binding to different types of properties.

Sample Property Type

Property Type to Bind

Binding Outcome (A binds to B)

Array (property A)

String (property B="Hi")

A="Hi"

Array (property A)

Content (property B="http://my.com/content")

A="http://my.com/content"

Array (property A)

Computed (property B="Hello")

A="Hello"