Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
    • Posted in
    • Tags

    [MOVED] RHN API & python script - works partially

    Posted on

    Hello,

    I am trying to play with RHN using python and would like to list all servers with their ip addresses:

    #!/usr/bin/python

    import xmlrpclib

    SATELLITE_URL = "http://xmlrpc.rhn.redhat.com/rpc/api"
    SATELLITE_LOGIN = "xxxxxx"
    SATELLITE_PASSWORD = "xxxxxx"

    client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
    key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)
    list = client.system.listUserSystems(key)

    for group in list:
        print '%-40s' % group.get('name'),
        sid=group.get('id')
        ip=client.system.getNetwork(key,int(sid))
        print ip.get('ip')

    client.auth.logout(key)
     

    But when I run it:

    # ./rhn-list-systems-with-ip.py > out.file

    I get list of some of these hosts in out.file (not all !) and then this script breaks and I get the following error:


    Traceback (most recent call last):
      File "./rhn-list-systems-with-ip.py", line 18, in ?
        ip=client.system.getNetwork(key,int(sid))
      File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__
        return self.__send(self.__name, args)
      File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request
        verbose=self.__verbose
      File "/usr/lib64/python2.4/xmlrpclib.py", line 1137, in request
        headers
    xmlrpclib.ProtocolError:
     

    Can anybody tell me what is going on ?

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat