N1 Grid Service Provisioning System 5.0 Command-Line Interface Reference Manual

Output Formats of CLI Commands

You can adjust the output format a CLI command. To specify the output format for a CLI command, the -o argument must immediately follow the command you specified by -cmd.

For example, to specify the string output format for the hdb.h.la command, type the following:


cr_cli -cmd hdb.h.la -o string -u user-name -p password

These are the standard output formats that are available to all CLI commands:

raw

Produces an internal string representation of the result that depends on the command.

string

Produces brief output.

serialized

Produces XML serialized text output.

Use this argument when you want to pass information to another script. Do not depend on the structure of this format, as it could change.

sink

Discards output.

On UNIX systems, output is redirected to /dev/null.

detail

Shows detailed information. Note that this format is not available for all commands.

If you do not specify an output format, the command uses its default output format. To see the default output format for a command, run the following:


cr_cli -cmd command -h

Converting the Output Format

Use the reformat.util command to convert the output format of a command that has been written to a file. The reformat.util command reads data from the specified output file and reformats it by using the specified output format.

For example, you created a host and stored the output from the hdb.h.add command in serialized format in a file named hostFile:


cr_cli -cmd hdb.h.add -o serialized -u user-name -p password -name myhost
-tID NM:roxhost > hostFile

Use the util.reformat command to reformat the output to be the hdb.detail format.


cr_cli -cmd util.reformat -o hdb.detail -u user-name -p password
-self file:hostFile

The previous command results in the following output:


ID: 010010000204-1027365659275-00170-1199101891
Name: myhost
Description: 
Virtual: false
Hidden: false
Type ID: 010010001024-0000000000000-00001-0000000004
Attributes:
<Table is empty>
Applications:
<Table is empty>