2 Methods to backup/restore configuration channels on a satellite 5.x server using rhncfg-manager or spacecmd

Latest response

ALTERNATE METHOD (scroll down) using spacecmd is mentioned by Red Hatter Rich Jerrido (thanks Rich) at this discussion.

Method One

I don't always move my configuration channels from one satellite server to another, but when I do, I use one of these methods (scroll down for the second method, which may be even easier).

This script requires the rpm package rhncfg-manager to be installed first, and before using this, the person must have an account on their satellite server with proper permissions to do this...

yum -y install rhn-management
---output truncated---
rhncfg-manager list-channels | egrep -v Available | perl -ne 'print "\tDownloading config channel $_\n";chomp;system("/bin/mkdir $_;rhncfg-manager download-channel -t $_/ $_ ")'
Red Hat Network username: 
Password:
echo "see image for sample output"

See attached image for output, ran from our new satellite 5.7 development satellite server with a few very minor sample configurations.

I am confident there's probably a more elegant way to do this... but this does work.

To import...

cd /to/the/path/where/you/saved/your/config/channels/
ls | perl -ne 'print;chomp;system("rhncfg-manager upload-channel --channel=$_ -t $_/")'

Method Two using "spacecmd"

There is a CLI (command line interface) called 'spacecmd' which comes with Satellite 5.7, you have to install it on satellite 5.6.

Once you enter spacecmd command line interface, then use the spacecmd CLI configchannel_export which creates a file named "cc_all.json" file

Then on the server you wish to import the channels on - use configchannel_import /my/path/to/my/json/cc_all.json

Responses

Nice work Remmele. I had not really considered that particular aspect of a drop-and-replace Satellite upgrade. I assume the configuration files are stored in the database somewhere as objects.

Thanks James,

I believe they are in the database. and here's the command to export custom child software channel content:

rhn-satellite-exporter --list-channels

I'll have to dig with it to be able to filter out distractors, however this would do at minimum one channel
~~~~
rhn-satellite-exporter --step=short -d DIRECTORY_DUMP_NAME -c YOUR_CUSTOM_CHANNEL
~~~

And apparently one can do a satellite-sync against the dump.

Tested on the following satellite server versions:5.4.1, 5.5, 5.6 and 5.7.
There were some systems where I could not run rhncfg-manager as a non-root user; I had to do a /bin/su - first.
NOTE: On those systems, After becoming root, I ran it with my satellite RHN administrator credentials (not root credentials), and it worked.

Somewhat, this is useful to us, since we are migrating to different clean database. Thumbs up!

Muhammad Zizuddin Zali, here's another alternative:

  • There is a CLI (command line interface) called 'spacecmd' which comes with Satellite 5.7, you have to install it on satellite 5.6.

Once you enter spacecmd command line interface, then use the spacecmd CLI configchannel_export which creates a file named "cc_all.json" file

Then on the server you wish to import the channels on - use spacecmd interface, and then use: configchannel_import /my/path/to/my/json/cc_all.json

Good luck

I'm personally preferring the spacecmd method... I wonder if they have a hammer cli version for satellite 6

the spacecmd method seems to be better however it seems to fail when directories are included and no patch available so far.

To be honest, I've never tried citing a path to a directory, I've always changed directory (cd) to either the file I create or the file I restore from. Good to know Ivan

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.