Created
June 13, 2011 18:28
-
-
Save dtolj/1023371 to your computer and use it in GitHub Desktop.
rhn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import xmlrpclib | |
SATELLITE_URL = "https://rhn.redhat.com/rpc/api" | |
SATELLITE_LOGIN = "dtolj1" | |
SATELLITE_PASSWORD = "password" | |
client = xmlrpclib.Server(SATELLITE_URL, verbose=1) | |
key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD) | |
#list_users = client.user.list_users(key) | |
list_sys= client.system.listUserSystems(key) | |
#for user in list_users: | |
# print user.get('login') | |
for group in list_sys: | |
print group.get('name') | |
sid=group.get('id') | |
ip=client.system.getNetwork(sid) | |
print ip.get('ip') | |
client.auth.logout(key) | |
body: '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>-1</int></value></member><member><name>faultString</name><value><string>Could not find method getNetwork in class class com.redhat.rhn.frontend.xmlrpc.system.SystemHandler</string></value></member></struct></value></fault></methodResponse>' | |
Traceback (most recent call last): | |
File "./auth_locin.py", line 20, in ? | |
ip=client.system.getNetwork(sid) | |
File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__ | |
return self.__send(self.__name, args) | |
File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request | |
verbose=self.__verbose | |
File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request | |
return self._parse_response(h.getfile(), sock) | |
File "/usr/lib/python2.4/xmlrpclib.py", line 1286, in _parse_response | |
return u.close() | |
File "/usr/lib/python2.4/xmlrpclib.py", line 744, in close | |
raise Fault(**self._stack[0]) | |
xmlrpclib.Fault: <Fault -1: 'Could not find method getNetwork in class class com.redhat.rhn.frontend.xmlrpc.system.SystemHandler'> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ip=client.system.getNetwork(key, int(sid))