The cr_cli command has the following syntax:
cr_cli -cmd command authentication-arguments [ other-arguments ] |
Note that most commands must use the authentication arguments: either -u and -p, or -s. To determine whether a command requires the authentication arguments, see the description of the command. Also, the authentication arguments do not have a fixed position on the command line, but they must appear after the -cmd, -h, -o, and -of arguments.
Name of the command to run.
All CLI commands use the following format:
subsystem.object.command |
For example, the command for adding a host to the database is hdb.h.add.
subsystem is the name of the subsystem, such as hdb for the host database commands.
object is the object that the command affects, such as h for a host.
command is the action that the command performs, such as add that adds a host to the database.
Most of the CLI commands require authentication, however, you do not need to authenticate to get help or to list the available commands.
User name to use for authentication. To authenticate, you must also specify a password for the specified user.
As an alternative to supplying the user name and password, you can specify a session ID.
Password that is used to authenticate the user specified by -u.
A password that you specify on the command line is not secure, as it can appear in process lists and in a shell's command-line history. So, to keep your password secure, store your user name and password in a file on the local file system and refer to that file as input to your command. See the first example in Example 1–1. Make sure that the user owns the file and that the file is only readable by that user.
Session ID that is used to authenticate a session.
For information about how to get the session ID and use it for authentication, see Reading Input From a File.
As an alternative to supplying the session ID, you can specify a user name and password by using the -u and -p arguments.
Arguments and values that are associated with command.
The cr_cli command returns 0 on success and 1 on failure.
The following are some examples of the provisioning software's CLI:
This example shows how to read the user name and password from a file to authenticate the command. The file, .terrypw, contains the user name and password for Terry in the following format:
-u terry -p securepasswd |
To authenticate the hdb.h.lo command, Terry runs the following command:
cr_cli -cmd hdb.h.lo -exp:.terrypw |
Store the file on a local file system and use the file permissions to restrict access to the file. For more information, see Reading CLI Arguments From a File.
This example shows how user, terry, retrieves information about the host, barolo7. This command supplies the password directly on the command line.
cr_cli -cmd hdb.h.lo -ID NM:barolo7 -u terry -p password |
Note that specifying the password in this way is insecure.
This example shows how to pass arguments that include spaces by enclosing the string in quotes. In this example, user terry modifies the description of the component named myWebServer:
cr_cli -cmd cdb.c.mod -comp myWebServer -desc "Version 3.7 of My Web Server" -u terry -p 123xyz |
On UNIX® systems, you can escape each space with a backslash character (\).
cr_cli -cmd cdb.c.mod -comp myWebServer -u terry -p 123xyz -desc Version\ 3.7\ of\ My\ Web\ Server |
Most of the objects that you create are associated with ID numbers. An ID number is a unique identifier for an object in the repository, such as a user account or a component.
While ID numbers are useful, they can be cumbersome to use. To use names rather than ID numbers, introduce the name of an object by using the NM: notation.
For a complete list of the supported NM: mappings, see Appendix A, Input Types.
For example, the following syntax is used to represent object IDs, such as hosts, user names, user group names, and host type names:
NM:host NM:user-name NM:user-group-name NM:host-type-name |
You can also use the NM: syntax to identify components and plans by name and optional version number:
NM:plan-name[:version] |
The following are some sample uses of this notation:
NM:simplePlan NM:simplePlan:1.0 NM:/foo/bar/simplePlan:1.1 |
If a version number is not specified, the provisioning software uses the latest version.