I'm trying to generate a list of all the packages installed per server without having to go through each using rpm. I'm thinking Satellite should be able to provide this in a decent (hopefully easily parsed) format.


Short answer: yes.

Longer answer: you'll need to look in to to the Satellite API. The documentation available with Satellite is good for a very basic query, but you'll quickly get in to queries that (IMHO) aren't as well documented. At a high level, what you'll end up doing is querying Satellite for a list of all registered systems, then using that list to issue queries for all installed packages on each system. Ultimately, this will only be valid as of the last time each system updated its package profile on the Satellite, but it'll be more central than trolling each individual system via an RPM query.

Here's the code I use (sanitized, of course) to list the systems registered to my Satellite:

import xmlrpclib

SAT_URL = "https://<satellite hostname>/rpc/api"
SAT_USER = "<satellite user name>"
SAT_PASS = "<password for above login id>"

client = xmlrpclib.Server(SAT_URL, verbose=0)
key = client.auth.login(SAT_USER, SAT_PASS)

syslist = client.system.listSystems(key)

The syslist variable is them a simple Python list of system objects - I've not yet had need to unzip it any further than:

for sys in syslist:
  print "%s registered with Satellite" % (sys['name'],)
  • Ok this is working. Looks like I'll need to dig into it some more but this is a really good start. Thanks. I'll see where I get and update. – Mark Jul 2 '13 at 12:52
  • I extended your script and posted the script as a solution. I'm not sure if that's the proper etiquette. – Mark Jul 2 '13 at 13:56

Here's a final script which extends John's answer to provide a full solution.

import xmlrpclib

SAT_URL = "https://<SATELLITE_IP>/rpc/api"

client = xmlrpclib.Server(SAT_URL, verbose=0)
key = client.auth.login(SAT_USER, SAT_PASS)

syslist = client.system.listSystems(key)
systems = {}
for system in syslist:
    systems[system['name']] = client.system.listPackages(key, system['id'])

# Print out list in a Markdown-like format.
for system in sorted(systems.keys()):
    print '%s' % system
    print '=' * len(system)
    for package in systems[system]:
        print '- %s %s' % (package['name'], package['version'])

Dont know about 5.3 but 5.6 command report list a lot of stuff from command line: See: https://access.redhat.com/documentation/en-US/Red_Hat_Satellite/5.6/html/User_Guide/chap-Red_Hat_Satellite-User_Guide-Red_Hat_Satellite_Reports.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.