Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Network > General > Issue <<  202 of 207 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 12722
Last update: 05-15-08
Issue:
How can I show the Red Hat Network (RHN) channels my system is currently subscribed to with yum?
Resolution:

This article describes how to get the equivalent functionality of the --show-channels option that was available with up2date in Red Hat Enterprise Linux 4 and below using Red Hat Enterprise Linux 5's new package manager, yum.

The following Python script will show a list of the Red Hat Network (RHN) channels a particular system is currently subscribed to:

#!/usr/bin/python 

import sys
import yum

myyum = yum.YumBase() 
myyum.doConfigSetup(debuglevel=0) 

repoCount = 0 
for repo in myyum.repos.listEnabled():
    print repo.id 
    repoCount = repoCount + 1 

if (0 == repoCount):
    sys.exit(1) 

sys.exit(0)

For this script to work, the system must be properly registered to Red Hat Network (RHN), and the yum-plugin-rhn package must be installed.


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Network > General > Issue <<   202  of  207  >>