Re: [Spacewalk-devel] YUM RHN Lock Plugin

2012-06-08 Thread Musayev, Ilya
Thanks Mirek

I will try to polish it, your response is very helpful.

Regards
Ilya

On Jun 8, 2012, at 4:57 AM, "Miroslav Suchý"  wrote:

> 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
> 

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Re: [Spacewalk-devel] YUM RHN Lock Plugin

2012-06-08 Thread Cliff Perry

On 06/08/2012 04:55 AM, Miroslav Suchý wrote:

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.



I think the main flaw in this is that the username/password is being 
used to login via public APIs to get this information. I suspect that 
long term a solution such as this would need to be able to gather this 
information without needing to login with username/password.


It is though a nice quick solution to this problem.

Cliff

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] YUM RHN Lock Plugin

2012-06-08 Thread Miroslav Suchý

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