Linux – way to get Satellite 5.3 to list which packages are installed on each system

linuxpackage-managementredhatrpmsatellite

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.

Best Answer

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

#!/usr/bin/python
import xmlrpclib

SAT_URL = "https://<SATELLITE_IP>/rpc/api"
SAT_USER = "<USERNAME>"
SAT_PASS = "<PASSWORD>"

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'])
    print
Related Topic