Hi Jesus

Using your script from http://fpaste.org/paste/7629 I can confirm that the work 
around does definitely work for spacewalk 0.2 but does not work for Satellite 
v5.1.1.  The only change to the script below that I made in testing was change 
the FQDN, username, password, system id and the path to the managed config file.

Thanks

CC

---
import xmlrpclib
import pprint
SATELLITE_HOST = "<satFQDN>"
SATELLITE_URL = "http://%s/rpc/api"; % SATELLITE_HOST
SATELLITE_LOGIN = "<uname>"
SATELLITE_PASSWORD = "<passwd>"

client = xmlrpclib.Server(SATELLITE_URL, verbose=0)


def login(name = SATELLITE_LOGIN, password = SATELLITE_PASSWORD):
    sessionkey = client.auth.login(name, password)
    return sessionkey

def logout(session_key):
    client.auth.logout(session_key)



def lookup_file_info(key, system_id, path):
    channels = client.system.config.list_channels(key, system_id)
    data  = client.system.config.lookup_file_info (key, system_id, [path], 1)
    if data:
        return data[0]
    for channel in channels:
        data  = client.configchannel.lookup_file_info (key, channel["label"], 
[path])
        if data:
            return data[0]
    return None

key = login()
pprint.pprint(lookup_file_info(key, 1000110, "/tmp/foo"))
logout()
---

Satellite v5.1.1 output was
---
[EMAIL PROTECTED] ~]# python xx.py
Traceback (most recent call last):
  File "xx.py", line 32, in ?
    pprint.pprint(lookup_file_info(key, 1000010543, 
"/etc/ssh/ssh_host_dsa_key.pub"))
  File "xx.py", line 22, in lookup_file_info
    data  = client.system.config.lookup_file_info (key, system_id, [path], 1)
  File "/usr/lib64/python2.3/xmlrpclib.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.3/xmlrpclib.py", line 1316, in __request
    verbose=self.__verbose
  File "/usr/lib64/python2.3/xmlrpclib.py", line 1080, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib64/python2.3/xmlrpclib.py", line 1219, in _parse_response
    return u.close()
  File "/usr/lib64/python2.3/xmlrpclib.py", line 742, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault -1: 'redstone.xmlrpc.XmlRpcFault: unhandled internal 
exception: null'>
---

Spacewalk 0.2 output was
---
[EMAIL PROTECTED] ~]# python xx.py
{'binary': False,
 'channel': 'cc-vm1',
 'contents': 'ssh-dss 
AAAAB3NzaC1kc3MAAACBAM35V/k6/tGn0SqZPcL6dfm4uMxisEm8yzlYc7r2bxQ7yQpjAdmuLAIVDo7GWAWYcDFQN7UYzw3YF+ZNjAqbK4nkMQvgiVnpQUhCgy5mM0P7YeBDb4SKgSwQGWIo1DqJSpdwLLAv8aLaFtAXWhGNdjCZQ8LlVtbMC3T8w7slIFM3AAAAFQCJFB1cZnC/hhirZKLwhWCjQBVXIQAAAIEAnYM5Ux3LNMuc2FYxnMgZmQN8K9GXkD2CJf9tLfJVCwLAOlDyqcPa4NfpZVzfXpf1u9dlhdE0Og4MpFzqCBs0KeJM2JVnwb7QWPEjeoicXxAgUCnczz3sx5DF0NpAOHukDhsHut+KolXd0+w+z1RDY2abWaR1BQwN1+hnlFXUBp8AAACAOkBPr75XCnua0htL/YAyksxyjkJkxenaONb/5zRl0TaGPblrW3ij340CmBU4RPrpioj9p2DPE0V1IjllLH/QmUBUQcvA76mMR1+z3EP+51HFpdJhwyGd2JQ+DNul0C6sJcj/I4lpqfWtJ5zqtjupy/FxCZx+y/DUsfZZP17IvHU=',
 'creation': <DateTime u'20081001T13:46:37' at 2b32010e48c0>,
 'group': 'root',
 'macro-end-delimiter': '|}',
 'macro-start-delimiter': '{|',
 'md5': '08a01bd33eeb244d021c72d984090d11',
 'modified': <DateTime u'20081001T13:46:37' at 2b32010e4b48>,
 'owner': 'root',
 'path': '/etc/ssh/ssh_host_dsa_key.pub',
 'permissions': 644,
 'revision': 6,
 'type': 'file'}
Traceback (most recent call last):
  File "xx.py", line 33, in ?
    logout()
TypeError: logout() takes exactly 1 argument (0 given)
[EMAIL PROTECTED] ~]#
---

NOTICE: This email and any attachments are confidential. 
They may contain legally privileged information or 
copyright material. You must not read, copy, use or 
disclose them without authorisation. If you are not an 
intended recipient, please contact us at once by return 
email and then delete both messages and all attachments.


_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to