Using Python with RHN API

Why use RHN API ?

  • RHN APU can be used to automate tasks for managing systems .
  • Connect to the Satellite server via XML-RPC library

See example below to get started, here is sample Python script :


Sample Python Script
#!/usr/bin/python
import xmlrpclib
URL = "https://satellite.example.com/rpc/api"
user = "rhn-username"
pswd = "rhn-password"
client = xmlrpclib.Server(URL, verbose=0)
session = client.auth.login(user, pswd)
list = client.user.list_assigned_system_groups(session, user)
for group in list:
print group.get('name')
client.auth.logout(session)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s