Sun N1 Service Provisioning System 5.1 Command-Line Interface Reference Manual

CLI Command Structure

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.

-cmd command

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.

authentication-arguments

Most of the CLI commands require authentication, however, you do not need to authenticate to get help or to list the available commands.

-u user-name

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.

-p password

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.

-s session-ID

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.

other-arguments

Arguments and values that are associated with command.

The cr_cli command returns 0 on success and 1 on failure.


Example 1–1 Using the CLI

The following are some examples of the provisioning software's CLI:


Using NM: to Perform ID Substitution

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.