On 06/08/2012 12:32 AM, Musayev, Ilya wrote:
The proof of concept code is below - if you could make any suggestions and
improvements - it would be appreciated.
Instead of getSystemID(xml) you can use:
from rhn import rpclib
system_id = re.sub('^ID-', '',
rpclib.xmlrpclib.loads(up2dateAuth.getSystemId())[0][0]['system_id'])
Instead of:
client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)
you can do:
cfg = config.initUp2dateConfig()
satellite_url = config.getServerlURL()[0]
scheme, netloc, path, query, fragment = \
urlparse.urlsplit(satellite_url)
satellite_url = urlparse.urlunsplit((scheme, netloc, '/rpc/api',
query, fragment))
client = xmlrpclib.Server(satellite_url, verbose=0)
This seems to be longer and complicated, but you get spacewalk url from
config and you will get all url of possible parents. You may have more
then once for fail over.
It would be nice if you do instead of:
satellite_url = config.getServerlURL()[0]
loop over all items in config.getServerlURL() if some network error happen.
Additionaly I would change:
enabled=1
to 0. Because it will cause huge problem to people who install it, but
did not register to Spacewalk server.
Anyway - good idea. If you will polish it and test it, I will be happy
to merge it to yum-rhn-plugin.
--
Miroslav Suchy
Red Hat Satellite Engineering
_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel