Skip to content

Instantly share code, notes, and snippets.

@jctanner
Last active August 29, 2015 13:58
Show Gist options
  • Save jctanner/10051651 to your computer and use it in GitHub Desktop.
Save jctanner/10051651 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import xmlrpclib, httplib, sys
from operator import itemgetter
SATELLITE_URL = "http://xmlrpc.rhn.redhat.com/rpc/api"
SATELLITE_LOGIN = "RHN_USERNAME"
SATELLITE_PASSWORD = "RHN_PASSWORD"
client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)
systems = client.system.listUserSystems(key,SATELLITE_LOGIN)
newlist = sorted(systems, key=itemgetter('last_checkin'))
#for i in systems:
for i in newlist:
print i.get('id'),i.get('name'),i.get('last_checkin')
client.auth.logout(key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment