FAT commands to enable platform independence
Command Line, SSH, Kerberized SSH, Telnet, Windows Command, and PowerShell adapters use a FAT command that enables the creation of platform-independent adapter requests.
The <fat-command> element contains multiple <command> elements, each containing a value that has syntax specific to a system type and an optional system version. The os-id and os-version attributes define the platform.
Valid values for the os-id element are:
During the execution of the adapter request, the adapter compares the value of the os-id (and os-version if provided) command attributes with the target system's type and version and executes the command that provides an exact match. If any of the os-ids in the <fat-command> element do not match with the target Windows OS, the adapter will search for the command where the os-id is Windows Default and execute the command for this os-id. If no exact match is found and Windows Default is not specified as an os-id, the adapter request is not executed and a compensation, if defined, is executed.
Like standard command elements, you can use multiple FAT command elements in a single adapter request.
The XML sample shown in the following figure uses the ping command to send five requests to server1. Only one command is executed, based on the operating-system type of the computer executing the command. If the operating-system type does not match any of the types provided, a compensation, if defined, is executed.
XML sample of a FAT command
<commands>
<fat-command>
<command os-id="Windows 2003">ping -n 5 server1</command>
<command os-id="SunOS" os-version="5.8">/usr/sbin/ping -s server1 565
</command>
<command os-id="Linux">/bin/ping -c 5 server1</command>
</fat-command>
</commands>
...
You can define more then one FAT command for each operating system. When you do that, you use a <commands> element to contain the <command> elements to be executed for a single operating system. You use the os-id and os-version attributes of the <commands> element. Additional attributes added to the <commands> element apply to the child <command> elements. In addition to the attributes in the <commands> element, each command can have individual attributes defined.
When using the multiple command structure, you can define only the os-id and os-version as attributes of the <commands> element. You can use all other valid command attributes on either the <commands> or <command> elements. If you specify an attribute in both the <commands> and the <command> elements, the attribute value in the <command> element takes precedence.
The following figure illustrates the options available with the multi-command structure for FAT commands. For the Linux ® commands, the first command has a timeout of 90 seconds and the second command has a timeout of 120 seconds.
XML sample of a multi-command structure for FAT commands
<commands>
<fat-command>
<commands os-id="Windows 2003" command-dir="/usr/scriptDir">
<command continue-on-failure='true'>command 1</command>
<command>command 2</command>
</commands>
<commands os-id="SunOS" os-version="5.8">
<command>command 1</command>
<command ignore-exit-code="true">command 2</command>
<command>command 3</command>
</commands>
<commands os-id="Linux" timeout-secs="120">
<command timeout-secs="90">command 1</command>
<command>command 2</command>
</commands>
</fat-command>
</commands>
...
The following figure shows an XML sample of FAT commands with Windows Default as the value for the os-id attribute.
XML sample of FAT commands with Windows Default as the value for the os-id attribute
<commands>
<fat-command>
<commands os-id="Windows 2003">
<command>ipconfig</command>
</commands>
<commands os-id="Windows 2000">
<command>dir</command>
</commands>
<commands os-id="Windows Default">
<command>hostname</command>
</commands>
</fat-command>
</commands>