Configuring spacecmd

To access a shell inside the Server container, run mgrctl term on the container host. From there, one can run the CLI tools as usual.

The following section provides configuration tips for spacecmd.

1. Setup spacecmd Credentials

Normally spacecmd prompts you for a username and password each time you attempt to login to the interactive shell. Alternatively you can configure spacecmd with a credentials file to avoid this requirement.

Procedure: Creating a spacecmd Credentials File
  1. Create a hidden spacecmd directory in your home directory and set permissions:

    mkdir ~/.spacecmd
    chmod 700 ~/.spacecmd
  2. Create a config file in ~/.spacecmd/ and provide proper permissions:

    touch ~/.spacecmd/config
    chmod 600 ~/.spacecmd/config
  3. Edit the config file and add the following configuration lines. (You can use either localhost or the FQDN of your Uyuni server):

    [spacecmd]
    
    server=FQDN-here
    
    username=username-here
    password=password-here
  4. Check connectivity by entering spacecmd as root:

     # spacecmd

2. spacecmd Quiet Mode

By default spacecmd prints server status messages during connection attempts. These messages can cause a lot of clutter when parsing system lists. The following alias will force spacecmd to use quiet mode thus preventing this behavior. Add the following line to your ~/.bashrc file:

alias spacecmd='spacecmd -q'

3. spacecmd Help

spacecmd help can be access by typing spacecmd -h --help

Usage: spacecmd [options] [command]

Options:
  -c CONFIG, --config CONFIG
                        config file to use [default: ~/.spacecmd/config]
  -u USERNAME, --username=USERNAME
                        use this username to connect to the server
  -p PASSWORD, --password=PASSWORD
                        use this password to connect to the server
  -s SERVER, --server=SERVER
                        connect to this server [default: local hostname]
  --nossl               use HTTP instead of HTTPS
  --nohistory           do not store command history
  -y, --yes             answer yes for all questions
  -q, --quiet           print only error messages
  -d, --debug           print debug messages (can be passed multiple times)
  -h, --help            show this help message and exit

As root you can access available functions without entering the spacecmd shell:

# spacecmd -- help

        Documented commands (type help <topic>):
========================================
activationkey_addchildchannels         org_trustdetails
activationkey_addconfigchannels        package_details
activationkey_addentitlements          package_listdependencies
activationkey_addgroups                package_listerrata
activationkey_addpackages              package_listinstalledsystems
activationkey_clone                    package_listorphans
activationkey_create                   package_remove
activationkey_delete                   package_removeorphans
activationkey_details                  package_search
activationkey_diff                     repo_addfilters
activationkey_disable                  repo_clearfilters
activationkey_disableconfigdeployment  repo_create

...