Sun Update Connection - Enterprise 1.0 User's Guide

Chapter 14 Command-Line Interface

The Command-line interface (CLI) is provided with the Sun Update Connection – Enterprise Suite. You can install it and activate it on any machine in the network that includes the other Sun Update Connection – Enterprise applications. The CLI enables Sun Update Connection – Enterprise Console functionality without opening the graphical user interface.

Sun Update Connection – Enterprise CLI commands can be run either as single lines or embedded in scripts.

This chapter covers The following topics:

Syntax

The command to initiate the CLI is uce_cli.


Note –

You can also initiate the CLI with the osc command, which still exists for backward compatibility purposes. This osc command might be removed in future releases.



uce_cli -command -parameter value [...] [-flag][...] -u username -p password

The following command searches for a component with apac in its name:


# uce_cli -fc -T "apac" -u myname -p mypass

Arguments

The uce_cli command has these two types of arguments:

You can specify the -verbose flag with any command to produce troubleshooting information as part of the command output.

Some commands have an optional parameter for the delimiter of output. The delimiter is the separator between items in output. By default, the delimiter is a line feed, so each item appears on a separate line. You can change the delimiter in commands that offer this option to any set of characters or whitespace that meets your requirements.

If you want each item to appear in one line with commas, specify -dlt ", " as the delimiter in the command.

Some commands have a parameter (usually -T or -pT) whose value is a component in the knowledge base. When providing the name of a component, in particular, of a Local component, include its knowledge base path, to ensure that the name is unique. For example, specify the -T parameter as follows:


-T "Local/Configuration files/yourCat/yourDec/yourFile"

User Names and Passwords

Every CLI command is accessed with an existing Sun Update Connection – Enterprise user name of a user with full permissions, or the admin user, and with its password. You may type these access details directly into the command with the -u and -p parameters.

If you do not provide the -u and -p parameters in the command, the CLI prompts for them:

# uce_cli -lg

command to list all groups 

Initializing ...

“Initializing” is output as notification. 

Username: admin

“Username” is prompted. 

Password:

“Password” is prompted. Input is hidden. 

Special Characters

If a parameter value has a space or a special character, close the value in straight quotation marks (" ").

The exclamation mark (!) is not a valid character even in quotes. To use it, you must protect it with a backward slash: \!.

Local components may have names with the forward slash (/). For example, you could create a category of Configuration files called "/etc", to show that these files have target installations in the /etc directory. In the CLI commands, when you use a component that has / in its name, protect it with a backslash (\), so that the CLI can identify it as part of a string rather than a path.

For example, say that you have a category named /etc, a file declaration named /etc/hosts, and a file version called /etc/hosts-5 in the Local components list.

The CLI requires that you refer to this hierarchy as the following:


ROOT/Local/Configuration files/\/etc/\/etc\/hosts/\/etc\/hosts-5

Commands

The CLI offers a set of commands to perform Sun Update Connection – Enterprise functions.

The commands can be divided into the following categories:

List and Find Commands

The commands in this section are useful for all the other commands. They are used to find the values of other parameters. For example, if you have a command that needs a distribution name, run the -ld command to get the list of valid input.

This section includes the following:

List Distributions (-ld) Command

The list-distributions command outputs the supported distributions on your local system.If you add the -all flag, all Sun Update Connection – Enterprise supported distributions are output.

Use this command to get valid values for the -D (distribution) parameter used in other CLI commands.

Flag

-all List all distributions supported by Sun Update Connection – Enterprise.

Without this flag, only the distributions that have been locally activated are listed. 

Syntax

uce_cli -ld [-all] -u username -p password

Example

uce_cli -ld -u admin -p 123

Result Example


Available Distributions:
RH9_IA32
SLES8_S390

Example

uce_cli -ld -all -u admin -p 123

Result Example


Available Distributions:
RH72_IA32
RH73_IA32
RH8_IA32
RH9_IA32
FC2_IA32
AS21_IA32
ES21_IA32
AS3_IA32
ES3_IA32
WS3_IA32
AS3_AMD64
WS3_AMD64
SUSE9_IA32
SUSE92_IA32
SLES8_IA32
SLES9_IA32
SLES7_S390
SLES8_S390
SLES8_AMD64
SUSE9_AMD64
SOLARIS8_SPARC

Find Component (-fc) Command

The find-component command returns the exact names of components.

Use this command to get the values for the -T or -pT parameter used by other commands.

Parameter

  • -T component Specify the name of the component. If you type part of a name, without -sons, the output will be all components that have this string in their names. The value you specify is case-insensitive.

  • -dlt delimiter Specify the delimiter for the output.

  • -D distribution Specify the distribution to use. If not specified, the command operates on all distributions.

Flag

-sons List the contained components of the component you specified with -T.

This flag operates only if the component listed with -T is the complete name of a category or package group holding packages.

If the -T value is not unique in the Components list, include the tree path; otherwise only the first component’s sons are output.

Syntax

uce_cli -fc -T "component" [ -sons ] [ -dlt "delimiter" ] [ -D distribution ] -u username -p password

Example

uce_cli -fc -T "ROOT" -sons -dlt ", " -D RH9_IA32 -u admin -p 123

Result Example

finding categories 

ROOT/, ROOT/ARCHITECTURES, ROOT/DISTRIBUTION, ROOT/FILESYSTEM, ROOT/HANDLER, ROOT/Hardware, ROOT/Local, ROOT/SPECIAL, ROOT/Software, ROOT/extensions

Example

uce_cli -fc -T "httpd" -sons -u admin -p 123

Result Example:

finding packages 


ROOT/Software/System Environment/Daemons/httpd/httpd-2.0.40-21
ROOT/Software/System Environment/Daemons/httpd/httpd-2.0.40-21.1
ROOT/Software/System Environment/Daemons/httpd/httpd-2.0.40-21.3
ROOT/Software/System Environment/Daemons/httpd/httpd-2.0.40-21.5
ROOT/Software/System Environment/Daemons/httpd/httpd-2.0.40-21.9

Example

uce_cli -fc -T "local" -u admin -p 123

Result Example:

partial string 


ROOT/Local
ROOT/Local/Local RPMs
ROOT/SPECIAL/active_rpmdb/Local RPM DataBase version 4.0
ROOT/Software/System/Libraries/glibc-locale
ROOT/Software/System/Libraries/glibc-locale/glibc-locale-2.3.3-118 [i586]

List All Hosts (-lah) Command

The list-all-hosts command outputs a complete list of all managed hosts in the system. Use this command to get values for the -h parameter of other parameters.

Parameter

-dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -lah [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -lah -u admin -p 123

List Host Properties (-lh) Command

The list-host command outputs the properties (such as IP address, distribution, and so on) of a given host.

Parameter

-h hostname Specify the host name.

Syntax

uce_cli -lh -h hostname -u username -p password

Example

uce_cli -lh -h webserver2 -u admin -p 123

Result Example


Host Data:
Host ID = 1
Host Name = webserver2
Unique String = lnx013
Host IP = 127.0.0.2
Host Type is: standard Host (maybe Master)
Host is Connected
Distribution ID is 9
Master Group ID = 0
Master Host ID =0
listen on port 8001

To get valid values for the -h parameter, use the -lah command.

Note that even if a managed host is not connected to Sun Update Connection – Enterprise at the time of the command, the data is still retrieved. An error number will be given (example: FailedErrCode = 34014464) if the host is not online.

List Host Inventory (-lhi) Command

The list-host-inventory command outputs the list of software installed on a given host.

Parameter

  • -h hostname Specify the host name.

  • -dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -lhi -h hostname [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -lhi -h lnx013 -dlt " " -u admin -p 123

Result Example


up2date-gnome-2.1.7-1 wu-ftpd-2.6.1-6 shapecfg-2....

To get valid values for -h, use the -lah command.

List Groups (-lg) Command

The list-group command lists all the groups. Use this command to get values for the -g parameter used in other CLI commands.

Parameter

-dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -lg [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -lg -u admin -p 123

Result Example


RH9_IA32 hosts
SLES8_S390 hosts
All Hosts
topGroup
topGroup/nestedGroup

Notice that nested groups are listed in a path. For any command that calls for the -g parameter to list a group, if you want a nested group, type its complete group path.

Groups that are named distribution_architecture hosts are default distribution groups. When an agent registers with the SDS, its distribution is recognized and the host is added to the appropriate distribution group. Each distribution group contains all the managed hosts of that distribution. The distribution groups’ host lists are system-defined and cannot be manually changed.

The All Hosts group is also a default group. It contains the complete list of managed hosts in your environment.

List Group’s Hosts (-lgh) Command

The list-group-hosts command outputs the hosts that are assigned to a given group.

Parameter

  • -g groupname Specify the name of the group.

  • -dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -lgh -g "groupname" [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -lgh -g "topGroup/nestedGroup" -u admin -p 123

Result Example


webserver2

(Note that quotations are required for group paths and for group names that contain spaces.) 

Example

uce_cli -lgh -g "nestedGroup" -u admin -p 123

Result Example

Error: Requested group not found.

(Error indicates that parent-group path is required for nested groups.) 

To get valid values for the -g parameter, use the -lg command.

List Profiles (-lp) Command

The list-profiles command outputs a list of all existing profiles.

Use this command to get values for the -P parameter of other CLI commands.

Parameter

-dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -lp [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -lp -u admin -p 123

Result Example


Check System
Perform Restart
Check Security
Upgrade All Components
Check Bugs Fix
Perform Restart + Reconfigure
Local Software Review
Check Withdrawn Patches

Note that the profiles listed in the result example are the default, predefined profiles. Even if you have not yet created profiles, this command will have output.

List Policies (-lc) Command

The list-policies command outputs a list of all existing policies, predefined answers for a dependency resolver (DR). Use this command to get values for the -C parameter of other CLI commands.

Parameter

-dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -lc [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -lc -dlt ", " -u admin -p 123

Result Example


autoSWchanges, lockKernelNode, Always ask me

The Always Ask Me policy is the default policy. Even if you have not yet created policies, this command will have output.

List Profile Attributes (-lpa) Command

The list-profile-attribute command outputs the attributes, the component-requirement combinations that make up a profile.

Parameter

  • -P profile Specify the name of an existing profile.

  • -dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -lpa -P "profile" [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -lpa -P "create WebServer" -u admin -p 123

Result Example


Profile name = createWebServer
from node = httpd-devel (RH9_IA32)
Install
from node = httpd (RH9_IA32)
Install
from node = httpd-manual (RH9_IA32)
Install
from node = vsftpd (RH9_IA32)
Uninstall
from node = tftp (RH9_IA32)
Uninstall
from node = ftp (RH9_IA32)
Install

To get valid values for -P, use the -lp command.

If a predefined profile is used for the -P parameter, the output will be just the name of the profile.

Notice that the action is listed under the component (node). Although the action is listed as install or uninstall or upgrade or downgrade, a profile checks compliance. If the component is already installed and the action is “Install,” nothing is done and the profile succeeds.

List Policy Attributes (-lca) Command

The list-policy-attribute command outputs the attributes, the component-action-answer combinations, that make up a confirmation policy.

Parameter

  • -C policy Specify the name of the existing confirmation policy.

  • -dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -lca -C "policy" [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -lca -C SWAutoYes -u admin -p 123

Result Example


Policy name - SWAutoYes
from node = Software (RH9_IA32) Install Yes
from node = Software (RH9_IA32) Upgrade Yes
from node = Software (RH9_IA32) Apply Fix Yes

To get valid values for -C, use the -lc command.

List Logs (-ll) Command

The list-logs command outputs logs for actions on selected components of a host or of a group. You might ask to see, for example, uninstallation actions on Local RPMs for the WebServers group, installations of Networking components on one host, or any install or uninstall of Software on All Hosts.

Parameter

  • -A action Specify the action. Legal values are All Actions, Installs, and Uninstalls.

  • -dlt delimiter Specify the delimiter for the output.

  • -g groupname Specify the name of the group.

  • -h hostname Specify the name of the host.

Syntax

uce_cli -ll -A action [ -dlt "delimiter" ] ( -g group | -h host ) -u username -p password

Example

uce_cli -ll -A Installs -h lnx13 -u admin -p 123

Result Example

Tue May 4 16:32:17 2004 lnx13 Install httpd-devel-2.0.3-1 (RH9_IA32) Job_buildWebServer rochelle

Explanation: time, host name, action, component, distribution, job name, and user name. 

Use the -lg to get values for the -g. Use the -lah to get values for the -h. Use the -ld to get values for the -D. Use the -fc to get values for the -T.

List Jobs Status (-ljs) Command

The list-job-status command outputs a list of jobs that you created with the current user name, according to the status criteria that you choose.

Parameter

-dlt delimiter Specify the delimiter for the output.

Flag

  • -all List all jobs.

  • -ok List jobs that completed successfully.

  • -fl List jobs that failed.

  • -pr List jobs that are in process.

  • -wc List jobs that are waiting for user confirmation.

Syntax

uce_cli -ljs [ -dlt "delimiter" ] ( -all | -ok | -fl | -pr | -wc ) -u username -p password

Example

uce_cli -ljs -ok -u admin -p 123

Result Example


makeWebServer
Deploy
Tue May 6 9:30:09 2004
All hosts finished successfully
anotherJob
Verify
Tue May 6 11:32:15 2004
All hosts finished successfully

Explanation: job name, mode, start time, status; for two jobs: “makeWebServer” and “anotherJob.” 

List Job Status Attributes (-ljsa) Command

The list-job-status-attributes command outputs status information (current status, profile data, and so on) of one job that you created with the current user name.

Parameter

  • -j jobname Specify the name of the job.

  • -dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -ljsa -j "jobname" [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -ljsa -j ProvServer -u admin -p 123

Result Example


makeWebServer
Deploy
Tue May 6 9:30:09 2004
All hosts finished successfully

Explanation: job name, job mode, start time, and status. 

To get valid values for the -j parameter, use the -ljs command.

If a host did not end successfully, more host and profile information is output.

List Saved Snapshots (-lss) Command

The list-saved-snapshots command outputs a list of saved snapshots. When you save an inventory of a host or of a group, you create a snapshot. A snapshot is also saved, for each selected host, before a job is deployed.

Parameter

  • -h hostname Specify the name of the host.

  • -g groupname Specify the name of the group.

  • -dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -lss ( -g group | -h host ) [ -dlt "delimiter" ] -u username -p password

Example


uce_cli -lss -g WebServers -u admin -p 123
uce_cli -lss -h lnxsrvr13 -u admin -p 123

You must specify either -h or -g.

To get valid values for the -h parameter, use the -lah command. To get valid values for the -g parameter, use the -lg command.

Host and Group Commands

The following commands allow you to view and manage hosts and groups of hosts.

This section includes the following:

Add Host (-ah) Command

The add-host command adds predefined host data to the system before agent installation. The agent on the host adds the host automatically. If there is already a host in the system with the given host name, the command results in an error.

Parameter

  • -h hostname Specify the name of the host.

  • -D distribution Specify the distribution to use. If not specified, the command operates on all distributions.

Syntax

uce_cli -ah -h hostname -D distribution -u username -p password

Example

uce_cli -ah -h wserver03 -D RH9_IA32 -u admin -p 123

To get valid values for the -D parameter, use the -ld command. The value of -h must not already be in the output of the -lah command.

Delete Host (-dh) Command

The delete-host command removes a host from the management of the system. This command is effective only if the agent has been stopped or uninstalled.

Parameter

-h hostname Specify the name of the host.

Syntax

uce_cli -dh -h hostname -u username -p password

Example

uce_cli -dh -h wserver03 -u admin -p 123

To get valid values for the -h parameter, use the -lah command.

Rename Host (-rh) Command

The rename-host command renames a host, from an existing name to a new name. The name of the host is not the DNS name (Unique String) of the machine, but the Sun Update Connection – Enterprise name of the host. You can change this name at any time without affecting the machine or its configurations.

Parameter

  • -sH hostname Specify the source host name of an existing host.

  • -tH hostname Specify the name of a target host.

Syntax

uce_cli -rh -sH hostname -tH hostname -u username -p password

Example

uce_cli -rg -sH lnx013 -tH mailserver_2 -u admin -p 123

To get valid values for the -sH parameter, use the -lah command.

A valid value for the -tH parameter is a new, unique host name. This name must not appear in the output of the -lah command.

Add Group (-ag) Command

The add-group command creates a new group of hosts.

Parameter

  • -g groupname Specify the name of a group.

  • -pG groupname Optionally specify the name of an existing parent group under which to create the group.

Syntax

uce_cli -ag -g "groupname" [ -pG "groupname" ] -u username -p password

Example

uce_cli -ag -g ApacheServers -pG WebServers -u admin -p 123

To get valid values for the -pG parameter, use the -lg command.

Add Host to Group (-ahg) Command

The add-host-group command assigns a managed host to a group.

Parameter

  • -h hostname Specify the name of a host.

  • -g groupname Specify the name of a group.

Syntax

uce_cli -ahg -h hostname -g "groupname" -u username -p password

Example

uce_cli -ahg -h wsrvr03 -g WebServers -u admin -p 123

To get valid values for the -h parameter, use the -lah command.

Valid values and results for the -g parameter:

Delete Group (-dg) Command

The delete-group command deletes a group and its sub-groups from the system. It does not unregister the managed hosts. It cannot be used on default groups.

Parameter

-g groupname Specify the name of the group.

Syntax

uce_cli -dg -g "groupname" -u username -p password

Example

uce_cli -dg -g WebServers -u admin -p 123

To get valid values for the -g parameter, use the -lg command.

Rename Group (-rg) Command

The rename-group command renames a group, from an existing name to a new name.

Parameter

  • -sG groupname Specify the source group name of an existing group.

  • -tG groupname Specify the name of a target group. This name must be a new group.

Syntax

uce_cli -rg -sG "groupname" -tG "groupname" -u username -p password

Example

uce_cli -rg -sG WebServers -tG webserver -u admin -p 123

To get valid values for the -sG parameter, use the -lg command.

A valid value for the -tG parameter is a new, unique group name. It must not appear in the output of the -lg command.

Local Component Commands

The following commands are used to manage local software and files.

This section includes the following:

Add Local Category (-alc) Command

The add-local-category command creates a new category under Local, under Probes, Pre-actions, Post-actions, Macros, or Configuration Files.

Use this command if you want to upload scripts and files to the local knowledge base. You cannot upload a local file or script until you have created a category to hold it.

Parameter

  • -T component Specify the name of the component. If you type part of a name, without -sons, the output will be all components that have this string in their names. The value you specify is case-insensitive.

  • -ds description Specify an optional description of the new category.

  • -pT category Specify the parent category name in which to create the new category. Valid values are: Probes, Pre-actions, Post-actions, Macros, Configuration files, or one of these, with /existing-subcategory.

  • -D distribution Specify the distribution to use. If not specified, the command operates on all distributions.

Syntax

uce_cli -alc -T "category" [ -ds "description" ] -pT "parent-category" [ -D distribution ] -u username -p password

Example

uce_cli -alc -T "PrintcapVersions" -ds "various config files to set up different printers" -pT "Configuration files" -u admin -p 123

To get a list of the valid values for the -pT parameter, use the -fc command, with "Local" as the value of its -T parameter.

One or both of "ROOT/Local/Local RPMs" or "ROOT/Local/Local PKGs" is listed, but are not valid values for the -alc command; all the other items in this output are acceptable.

Add Software Package (-asp) Command

The add-software-package command pushes a local software package to the local knowledge base.

Parameter

  • -f pathname Specify the full path name of the source RPM file.

  • -T category Specify the name of the category in which to add this RPM.

  • -D distribution Specify the distribution to use. If not specified, the command operates on all distributions.

Flag

-secure Security fix mark. If present, the local package is a security fix for a previous version.

Syntax

uce_cli -asp -f "pathname" [ -secure ] -D distribution [ -T category ] -u username -p password

Example

uce_cli -asp -f "/usr/share/myApps/myApp01.05-73.rpm" -D RH9_IA32 -u admin -p 123

To learn more about the security fix mark and when to use the -secure flag, see To Fix Local Software Missing Dependencies and Fixing Local Dependencies.

To get valid values for the -D parameter, use the -ld command.

Add File Declaration (-afd) Command

The add-file-declaration command adds a file declaration to the local knowledge base. A file declaration is the target path name for installation of a local Configuration file onto managed hosts.

Parameter

  • -pT category Specify the parent category name in which to create the new category. This value must be a user-defined category under Configuration files.

  • -ds description Specify an optional description of the new file.

  • -tfp pathname Specify the target path name for installation on remote hosts.

  • -D distribution Specify the distribution to which the file applies. If not specified, the command operates on all distributions.

Syntax

uce_cli -afd -pT "category" [ -ds "description" ] -tfp "pathname" [ -D distribution ] -u username -p password

Example

uce_cli -afd -pT "Configuration files/PrintcapVersions" -ds "install directory for printcap versions" -tfp "/etc/printcap" -u admin -p 123

Before you can create a file declaration, you have to have a category under Configuration files. Use the -alc command to create a category. To see a list of categories, use the -fc command with -T "Local/Configuration files" -sons.

The output of this command would give valid values for the -pT parameter of the -afd command. You can shorten the path of the category component to Configuration files/category. You do not need to type the full path from the root.

Add Target Local (-atl) Command

The add-target-local command adds a file or a script to the local knowledge base.

Parameter

  • -pT category Specify the parent category name in which to create the new category. Valid values are: Probes, Pre-actions, Post-actions, Macros, Configuration files with a user-defined subcategory.

  • -f pathname Specify the full path name of the file to upload.

  • -ds description Specify an optional description.

  • -D distribution Specify the distribution for which this category is relevant. If not specified, the command operates on all distributions.

  • -tF If -f is a configuration file, creates a file declaration.

  • -tM If -f is a macro, use -tM with a display name for the macro.

  • -tP If -f is a pre-action, use -tP with a display name for the pre-action.

  • -tR If -f is a probe, use -tR with a display name for the probe.

  • -tS If -f is a post-action, use -tS with a display name for the post-action.

  • -v version Specify the version of the file. This is mandatory for configuration files only to supply a version suffix display name.

Syntax

uce_cli -atl -f "pathname" -pT category [ -ds "description>" ] ( -tF | -tM | -tP | -tR | -tS name ) [ -v version ] [ -D distribution ] -u username -p password

Example: Config file

uce_cli -atl -f "/home/admin/myFiles/print_v5" -pT "Configuration files/PrntVer" -ds "printcap Flr5" -tF "/etc/printcap" -v "05" -u admin -p 123

Example: Macro

uce_cli -atl -f "/home/admin/scripts/findhost.sh" -pT "hostname" -ds "finds local hostname for file localization" -tM "hostname" -u admin -p 123

Notes

Before performing this procedure, you must have created the category PrntVer under Configuration files and the category hostname under Macros (see Add Local Category (-alc) Command). You must also have created a script to upload as a macro. The example shows a script that finds the host name of the local host.

To find a valid value for -pT, use -fc with -T "Local/default category>/" -sons.

To find a valid value for -D, use the -ld command. If you do not name a specific distribution, the named parent category (value of -pT) must also be in all distributions.

The -t* parameter that you choose to use must match the -pT parameter. For example, if -pT is Macros/localhostname then use -tM to name the macro.

The -tM, -tP, -tR, and -tS parameters take any new name as a value.

The -tF parameter needs a file declaration as its value. If you use a new path name for this value, it creates a new file declaration. If you use -tF, you must use -v to give the Configuration file a display version.

Policy Commands

The following commands are for profiles and confirmation policies.

This section includes the following:

Add Profile Attribute (-apa) Command

The add-profile-attribute command edits an existing profile by adding a new component-setting to the profile. It may also be used to create a new profile.

Parameter

  • -P profile Specify the name of a new or existing profile.

  • -T component Specify the name of the component to be included in this profile.

  • -D distribution Specify the distribution for which this profile is relevant. If not specified, the command operates on all distributions.

Flag

  • -N Marks the component as Not Allowed.

  • -R Marks the component as Required.

  • -U Marks the component for upgrade if a newer version is available.

Syntax

uce_cli -apa -P "profile" -T "component" ( -N | -R | -U ) [ -D distribution ] -u username -p password

Example

uce_cli -apa -P myWebSvr -T "httpd" -R -u admin -p 123

uce_cli -apa -P myWebSvr -T "httpd" -U -u admin -p 123

Result Example

The myWebSvr profile now has two more settings than it originally had: now httpd components are Required and must be Updated. If the profile did not exist before, it is created.

To get a valid value for a name of an existing profile for the -P parameter, use the -lp command. To get a valid value for the -T parameter, use the -fc command. To get a valid value for the -D parameter, use the -ld command.

Add Policy Attribute (-aca) Command

The add-policy-attribute command edits an existing policy, by adding a new component-action-answer to the policy. This command can also be used to create a new policy.

Parameter

  • -C policy Specify the name of a new or existing policy.

  • -T component Specify the name of the component for which the policy answers questions.

  • -D distribution Specify the distribution for which this policy is relevant. If not specified, the command operates on all distributions.

  • -install answer Specify the policy value for installing a component. Valid values are yes, no, and ask_me.

  • -downgrade answer Specify the policy value for downgrading a component. Valid values are yes, no, and ask_me.

  • -fix answer Specify the policy value for fixing a component. Valid values are yes, no, and ask_me.

  • -remove answer Specify the policy value for removing a component. Valid values are yes, no, and ask_me.

  • -upgrade answer Specify the policy value for upgrading a component. Valid values are yes, no, and ask_me.

  • -ignore answer Specify the policy value for ignoring file conflicts. Valid values are yes, no, and ask_me.

Syntax

uce_cli -aca -C "policy" -T "component" ( -install | -downgrade | -fix | -remove | -upgrade | -ignore ) ( yes | no | ask_me ) [ -D distribution ] -u username -p password

Example

uce_cli -aca -C newPolicy -T "User Interface" -remove no -u admin -p 123

One action parameter, and only one, is mandatory, with a value of either yes, no, or ask_me.

To get a valid value for an existing policy name for the -C parameter, use the -lc command; or use a new one to create a new policy. To get a valid value for the -T parameter, use the -fc command. To get a valid value for the -D parameter, use the -ld command.

Copy Profile (-cp) Command

The copy-profile command copies an existing profile to a new one. You can then use -apa command to further customize the copied profile.

Parameter

  • -sP source-profile Specify the name of an existing source profile.

  • -tP target-profile Specify the name of the target profile that receives settings of the source profile.

Syntax

uce_cli -cp -sP source-profile -tP target-profile -u username -p password

Example

uce_cli -cp -sP webServer -tP webServerHTTP -u admin -p 123

To get a valid value for the -sP parameter, use the -lp command.

Copy Policy (-cc) Command

The copy-policy command copies an existing policy to a new one. You can then use the -aca command to further customize the copied policy.

Parameter

  • -sC source-policy Specify the name of an existing source policy.

  • -tC target-policy Specify the name of the target policy that receives settings of the source policy.

Syntax

uce_cli -cc -sC source-policy -tC target-policy -u username -p password

Example

uce_cli -cc -sC SWAutoYes -tC SWYesKernelNo -u admin -p 123

To get valid values for the -sC parameter, use the -lc command.

Export (-exp) Command

The export command allows you to export Profiles or Inventories to XML files. An Sun Update Connection – Enterprise object in XML format is easy to read and edit, and can be manipulated as a file.

Parameter

  • -ent entity-type Specify the type of the entity. Valid values are Profile or Inventory.

  • -f pathname Specify the full path name of the XML file to which to export.

  • -T list Specify a comma-separated list of profiles to export or a list of hosts whose inventories are to be exported. If not specified, all objects of type -ent are exported.

Syntax

uce_cli -exp -ent ( "Profile" | "Inventory" ) -f pathname.xml [ -T "profile,profile,..." | "hostname,hostname,..." ] -u username -p password

Example

uce_cli -exp -ent "Profile" -f /home/stuff/httpSverProfile.xml -u admin -p 123

Example

uce_cli -exp -ent "Inventory" -f /home/stuff/myHost.xml -u admin -p 123

Example

uce_cli -exp -ent "Inventory" -T "lnx13,lnx10" -f /home/stuff/rpmsOf13-10.xml -u admin -p 123

To get valid values for -T, use the -lp command to see profiles, or the -lah to see hosts.

Be aware that as this command creates a file outside of Sun Update Connection – Enterprise, the success of the command is dependent upon your user permissions: the machine user executing the command has to have permissions to write to the path give in the -f parameter.

Import (-imp) Command

The import command allows you to import XML files into Sun Update Connection – Enterprise and convert them back to profiles.

Parameter

-f filename Specify the full path name to the XML file to import.

Syntax

uce_cli -imp -f path/filename.xml -u username -p password

Example

uce_cli -imp -f /home/stuff/httpSverProfile.xml -u admin -p 123

Job Commands

The following commands create and manage jobs and job tracking.

This section includes:

Submit Job (-sj) Command

The submit-job command creates a job from a profile, a confirmation policy, and a selected host or group, and submits it to the dependency manager.

Parameter

  • -j jobname Specify the name of the new job. If you do not supply this value, the job is given a name based on the date and time it was sent.

  • -P profile Specify the name of an existing profile.

  • -C policy Specify the name of an existing policy.

  • -h hostname Specify a single host name on which to run the job. This parameter cannot be used with the -g parameter.

  • -g groupname Specify a group name on which to run the job. This parameter cannot be used with the -h parameter.

Flag

  • -us Use only secure components to fulfill dependency requirements.

  • -dp Run the job in deploy mode. You must specify this flag if you want the job to actually make changes to the target host.

  • -sm Run the job in simulation mode. Jobs are run in simulation mode by default.

Syntax

uce_cli -sj [ -j "jobname" ] -P "profile" -C "policy" ( -g "groupname" | -h hostname ) [ -us ] ( -dp | -sm ) -u username -p password

Example

uce_cli -sj -j MakeWebServer -P webserverApps -C autoSW -h lnx13 -us -dp -u admin -p 123

uce_cli -sj -j 31_12_2003 -P UpgradeApache -C "Always ask me" -g webservers -sm -u admin -p 123

Either -h or -g must be given. If you do not give either -dp or -sm, the default mode for the job is simulate (not deploy).

To get a valid value for the -j parameter, use the -ljs command. To get a valid value for the -P parameter, use the -lp command. To get a valid value for the -C parameter, use the -lc command. To get a valid value for the -h parameter, use the -lah command. To get a valid value for the -g parameter, use the -lg command.

Delete Job (-dj) Command

The delete-job command deletes a completed job from the Status list (used to keep the output of -ljs relevant), or cancels and deletes an unfinished job.

Parameter

-j jobname Specify the name of the job.

Syntax

uce_cli -dj -j "jobname" -u username -p password

Example

uce_cli -dj -j "MakeWebServer" -u admin -p 123

To get valid values for the -j parameter, use the -ljs command.

Inventory Commands

The following commands allow you to access, save, and compare the inventory (list of installed software) of a host or of a group.

This section includes the following:

Save Host Inventory (-shi) Command

The save-host-inventory command saves a snapshot (a record of the host’s inventory at the current time) of the given host.

Parameter

  • -h hostname Specify the name of the host.

  • -s snapshot-name Specify the name of the snapshot.

Syntax

uce_cli -shi -h hostname -s snapshot-name -u username -p password

Example

uce_cli -shi -h lnxsrvr13 -s beforeUpdate -u admin -p 123

To get valid values for -h, use the -lah command.

Save Group Inventory (-sgi) Command

The save-group-inventory command saves a snapshot of the inventory of each host in the given group.

Parameter

  • -g groupname Specify the name of the group.

  • -sn suffix-name Specify the name of the snapshot suffix. When you save a snapshot for a group, a snapshot is created with the following file name format: hostname-suffix-timestamp.

Syntax

uce_cli -sgi -g "groupname" -sn suffix -u username -p password

Example

uce_cli -sgi -g WebServers -sn wsrvrs -u admin -p 123

Result Example


lnx01-wsrvrs-932111203
lnx12-wsrvrs-933111203
admin0-wsrvrs-9341112033
web13-wsrvrs-93111203

To get valid values for -g, use the -lg command.

Delete Saved Snapshot (-dss) Command

The delete-saved-snapshot command deletes a selected saved snapshot.

Parameter

  • -h hostname Specify the name of the host.

  • -s snapshot-name Specify the name of the snapshot.

Syntax

uce_cli -dss -h hostname -s snapshot -u username -p password

Example

uce_cli -dss -h lnxsrvr13 -s inventory_beforeRestore -u admin -p 123

To get a valid value for the -h parameter, use the -lah command. To get a valid value for the -s parameter, use the -lss command.

Convert Inventory to Profile (-cip) Command

The convert-inventory-profile command saves the software inventory of a host into a profile. All software installed on the host is marked as Required on the profile; everything else is marked as Not Allowed.

Parameter

  • -h hostname Specify the name of the host.

  • -P profile Specify the name of the profile.

Syntax

uce_cli -cip -h hostname -P "profile" -u username -p password

Example

uce_cli -cip -h lnxsrvr13 -P lnxsrvrProfile -u admin -p 123

To get valid values for the -h parameter, use the -lah command.

Convert Snapshot to Profile (-csp) Command

The convert-snapshot-profile command converts a saved software inventory (a snapshot) of a host as a profile. All software listed in the snapshot is marked as Required on the profile; everything else is marked as Not Allowed.

Parameter

  • -h hostname Specify the name of the host.

  • -s snapshot-name Specify the name of the snapshot.

  • -P profile Specify the name of the profile.

Syntax

uce_cli -csp -h hostname -s snapshot-name -P "profile" -u username -p password

Example

uce_cli -csp -h lnxsrvr13 -s beforeUp -P oldSrv -u admin -p 123

To get a valid value for the -h parameter, use the -lah command. To get a valid value for the -s parameter, use the -lss command.

Compare Hosts and Inventories (-chi) Command

The compare-host-inventory command compares the installed software of two hosts, or the snapshots of two hosts. You may also compare the inventory or snapshot of a host against the snapshot of a group. The result of this command is the set of differences.

Parameter

  • -h hostname Specify the name of the source host.

  • -s snapshot-name Specify the name of the source snapshot.

  • -t hostname Specify the name of the target host.

  • -ts snapshot-name Specify the name of the target snapshot.

  • -dlt delimiter Specify the delimiter for the output.

Syntax

uce_cli -chi -h source-hostname [ -s source-snapshot ] -t target-hostname [ -ts target-snapshot ] [ -dlt "delimiter" ] -u username -p password

Example

uce_cli -chi -h lnx13 -s lnxInvDec03 -t lnx29 -ts lnxInvDec18 -u admin -p 123

To get valid values for the -h and -t parameters, use the -lah command. To get values for the -s and -ts parameters, use the -lss command.

Whether -s and -ts are optional or mandatory depends on the type of comparison you are making. Comparison matrix:

Type 

-h

-t

-s

-ts

Compare two hosts, current inventories 

Different hosts 

Different hosts 

Not used 

Not used 

Compare two hosts, saved snapshots 

Different hosts 

Different hosts 

From -lss, each is a different snapshot

From -lss, each is a different snapshot

Compare current host to group snapshot 

Host in source group 

Target host 

From -lss

Not used 

Compare host at different stages of lifecycle 

Same host named for both parameters 

Same host named for both parameters 

From -lss, each is a different snapshot

From -lss, each is a different snapshot

Submit Compare Job (-scj) Command

The submit-compare-job command compares the installed software of two hosts, or the snapshots of two hosts, and then changes the inventory of the target host to duplicate the inventory of the source host. The result of this command is application provisioning to the target host.

If the hosts are Solaris machines, you can compare either Software or Patches in one compare job.

Parameter

  • -h hostname Specify the name of the source host.

  • -s snapshot-name Specify the name of the source snapshot.

  • -t hostname Specify the name of the target host.

  • -j jobname Specify the name of the job.

  • -C policy Specify the name of the policy.

Flag

  • -sm Run the job in simulation mode. This is the default mode.

  • -dp Run the job in deploy mode. If you want the job to actually make changes on the target host, you must use this flag.

Syntax

uce_cli -scj -h source-hostname [ -s source-snapshot ] -t target-hostname -j "jobname" -C "policy" [ -sm | -dp ] -u username -p password

Example

uce_cli -scj -h lnxsrvr13 -t lnxsrvr29 -j Make29Like13 -C autoSW -dp -u admin -p 123

To get a valid value for -h and -t, use the -lah command. To get a valid value for -s, use the -lss command. To get a valid value for -j, use the -ljs command. To get a valid value for -C, use the -lc command.

Help Commands

The following commands access helpful information.

Help (-h) Command

The help command outputs usage information. Notice that this command does not operate with a user name and password.

Syntax

  • uce_cli -h

    This line outputs the complete command list with descriptions.

  • uce_cli

    Without a specific command to work on, the CLI provides the command list and descriptions to help you enter the command you want in the correct format.