Synchronization CLI Tools

There are two tools for synchronizing clients to the server. For clients that are connected to the SUSE Customer Center, use mgr-sync. For all other clients, use spacewalk-repo-sync.

Synchronize SCC Repositories With mgr-sync

The primary use of mgr-sync is to connect to the SUSE Customer Center, retrieve product and package information, and prepare channels for synchronization with the Uyuni Server.

This tool is designed for use with a SUSE support subscription. It is not required for open source distributions, including openSUSE, CentOS, and Ubuntu.

The available commands and arguments for mgr-sync are listed in this table. Use this syntax for mgr-sync commands:

mgr-sync [-h] [--version] [-v] [-s] [-d {1,2,3}] {list,add,refresh,delete}
Table 1. mgr-sync Commands
Command Description Example Use

list

List channels, organization credentials, or products

mgr-sync list channels

add

Add channels, organization credentials, or products

mgr-sync add channel <channel_name>

refresh

Refresh the local copy of products, channels, and subscriptions

mgr-sync refresh

delete

Delete existing SCC organization credentials from the local system

mgr-sync delete credentials

sync

Synchronize specified channel or ask for it when left blank

mgr-sync sync channel <channel_name>

To see the full list of options specific to a command, use this command:

mgr-sync <command> --help
Table 2. mgr-sync Optional Arguments
Option Abbreviated option Description Example Use

help

h

Display the command usage and options

mgr-sync --help

version

N/A

Display the currently installed version of mgr-sync

mgr-sync --version

verbose

v

Provide verbose output

mgr-sync --verbose refresh

store-credentials

s

Store credentials a local hidden file

mgr-sync --store-credentials

debug

d

Log additional debugging information. Requires a level of 1, 2, 3. 3 provides the highest amnount of debugging information

mgr-sync -d 3 refresh

no-sync

N/A

Use with the add command to add products or channels without beginning a synchronization

mgr-sync --no-sync add <channel_name>

Logs for mgr-sync are located in:

  • /var/log/rhn/mgr-sync.log

  • /var/log/rhn/rhn_web_api.log

Synchronize Repositories with spacewalk-repo-sync

The spacewalk-repo-sync tool synchronizes software repositories into Uyuni channels. In most cases, this happens automatically, but you can use the tool to run it manually if required.

The spacewalk-repo-sync tool has these primary commands:

Table 3. spacewalk-repo-sync Options
Option Description Example Use

list

List all custom channels and the repositories assigned to them.

spacewalk-repo-sync --list

channel

Synchronize a single channel to all repositories assigned to it.

spacewalk-repo-sync --channel <custom-channel>

deep-verify

ignore cached package checksums.

spacewalk-repo-sync --deep-verify

force-all-errata

force re-importing all the patches.

spacewalk-repo-sync --deep-verify

no-packages

excludes packages from the operation.

spacewalk-repo-sync --deep-verify --no-packages

For a complete list of options, see the spacewalk-repo-sync manpage:

man spacewalk-repo-sync

Troubleshooting Synchronization

If you are having trouble synchronizing with spacewalk-repo-sync you can find out more by watching the HTTP log as the command runs.

Procedure: Troubleshooting Synchronization Problems
  1. Log the HTTP output into /var/log/zypper.log:

    ZYPP_MEDIA_CURL_DEBUG=2 spacewalk-repo-sync --channel <channel-label>
  2. Export the setting:

    export URLGRABBER_DEBUG=DEBUG
  3. Start the synchronization:

    /usr/bin/spacewalk-repo-sync --channel <channel-label> --type yum
    You can increase the debug level, by adding the [option]``-vvv`` option to the command.
  4. When the complete completes, or fails, disable debug mode:

    unset URLGRABBER_DEBUG

Add Custom Extra HTTP Headers

You can add custom HTTP headers to the requests made by spacewalk-repo-sync at the time of synchronization. The custom HTTP headers are defined in the /etc/rhn/spacewalk-repo-sync/extra_headers.conf configuration file. The headers can be defined by repository name or channel label. You can also define global headers by putting them in the main section. For example:

[testchannel]
X-MY-HEADER-1=VALUE
X-MY-HEADER-2=VALUE

[mychannel]
X-MY-HEADER-3=VALUE
X-MY-HEADER-4=VALUE

[main]
X-MYGLOBAL-HEADER=VALUE

This can be particularly useful when dealing with Red Hat Update Infrastructure (RHUI) repositories in the public cloud.