Re: [Openstack] Common openstack client library

2012-08-14 Thread Alessio Ababilov
Yes, my library can be safely moved into python-keystoneclient and it will
be quite logical. However, python-keystoneclient contains plenty of
keystone-specific code that's not used by, e.g., novaclient, so it's better
to keep python-keystoneclient and python-openstackclient-base separated.


On Mon, Aug 13, 2012 at 11:45 AM, Chmouel Boudjnah chmo...@chmouel.comwrote:

 On Mon, Aug 13, 2012 at 9:39 AM, Alessio Ababilov
 aababi...@griddynamics.com wrote:
  from openstackclient_base.client import HttpClient
  http_client = HttpClient(username=..., password=...,
 tenant_name=...,
  auth_uri=...)

 Shouldn't be the role of python-keystoneclient?

 Chmouel.

 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp




-- 
Alessio Ababilov
Software Engineer
Grid Dynamics
___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


[Openstack] Common openstack client library

2012-08-13 Thread Alessio Ababilov
Hi!

I have an implementation of blueprint
https://blueprints.launchpad.net/nova/+spec/basic-client-library. The
library is accessible at https://github.com/aababilov/python-openstackclient
-base.

This library is actively used in Grid Dynamics for two month and is quite
stable.

This library can be very useful for python-openstackclient (that started to
build its own client wrapper) and nova server.

Unfortunately, nova, keystone, and glance clients are very inconsistent. A
lot of code is copied between all these clients instead of moving it to a
common library. The code was edited without synchronization between
clients, so, they have different behaviour:

   - all client constructors use different parameters (api_key in nova or
   password in keystone and so on);
   - keystoneclient authenticates immediately in __init__, while novaclient
   does in lazily during first method call;
   - {keystone,nova}client can manage service catalogs and accept
   keystone's auth URI while glanceclient allows endpoints only;
   - keystoneclient can support authorization with an unscoped token but
   novaclient doesn't;
   - novaclient uses class composition while keystoneclient uses
   inheritance.

I have developed a library to unify current clients. The library can be
used as-is, but it would be better if openstack clients dropped their
common code (base.py, exceptions.py and so on) and just began to import
common code.

The library performs file chunking that is necessary for the glance client.
Also, it performs reauthentication if the token is expired.

Here is an example of using unified clients.

from openstackclient_base.base import monkey_patch # optional
monkey_patch() # optional

from openstackclient_base.client import HttpClient
http_client = HttpClient(username=..., password=...,
tenant_name=..., auth_uri=...)

from openstackclient_base.nova.client import ComputeClient
print ComputeClient(http_client).servers.list()

from openstackclient_base.keystone.client import IdentityPublicClient
print IdentityPublicClient(http_client).tenants.list()


-- 
Alessio Ababilov
Software Engineer
Grid Dynamics
___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Common openstack client library

2012-08-13 Thread Chmouel Boudjnah
On Mon, Aug 13, 2012 at 9:39 AM, Alessio Ababilov
aababi...@griddynamics.com wrote:
 from openstackclient_base.client import HttpClient
 http_client = HttpClient(username=..., password=..., tenant_name=...,
 auth_uri=...)

Shouldn't be the role of python-keystoneclient?

Chmouel.

___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Common openstack client library

2012-06-20 Thread Alexey Ababilov
Hi!

The library is accessible at
https://github.com/aababilov/python-openstackclient-base. I have update it
so it doesn't require monkey patch for nova and keystone clients anymore.

I'm familiar with
python-openstackclienthttps://github.com/openstack/python-openstackclient,
and it will be an awesome tool. But it is a console client, and I am
talking about an API client library. This library can be used by
python-{nova,keystone,glance}client that are used, in their turn, by
python-openstackclient https://github.com/openstack/python-openstackclient,
horizon, etc.

I used modified code from glance that does chunking manually. It's worth to
mention that glance client can be simpler - it should not deal with chunkes
anymore. Requred changes for glanceclient are accessible here:
https://github.com/aababilov/python-glanceclient/commit/7b04a1672a4ba09281ea107c47a8b20d9a0c62bb
.

openstack-common seems to be a stub for a server and there is no client
code, isn't it?

Sincerely

On Tue, Jun 19, 2012 at 8:14 PM, Monty Taylor mord...@inaugust.com wrote:

 Hi!

 On 06/19/2012 09:43 AM, Alexey Ababilov wrote:
  Hi!
 
  Unfortunately, nova, keystone, and glance clients are very inconsistent.
  A lot of code is copied between all these clients instead of moving it
  to a common library. The code was edited without synchronization between
  clients, so, they have different behaviour:
 
* all client constructors use different parameters (api_key in nova or
  password in keystone and so on);
* keystoneclient authenticates immediately in __init__, while
  novaclient does in lazily during first method call;
* {keystone,nova}client can manage service catalogs and accept
  keystone's auth URI while glanceclient allows endpoints only;
* keystoneclient can support authorization with an unscoped token but
  novaclient doesn't;
* novaclient uses class composition while keystoneclient uses
 inheritance.
 
  I have developed a library to unify current clients. The library can be
  used as-is, but it would be better if openstack clients dropped their
  common code (base.py, exceptions.py and so on) and just began to import
  common code.

 There are two projects already in work focused on various aspects of
 this. openstack-common is the place that we put code that should be
 shared between the clients. python-openstackclient is a project that
 aims at a single consistent interface.

 I'm thrilled that you have done some work in this area, but it would be
 great if you could do this in the context of the two fairly official
 projects that already exist.

 Thanks!
 Monty


  Here is an example of using unified clients.
 
  from openstackclient_base import patch_clients
  from openstackclient_base.client import HttpClient
  http_client = HttpClient(username=..., password=...,
 tenant_name=..., auth_uri=...)
 
  from openstackclient_base.nova.client import ComputeClient
  print ComputeClient(http_client).servers.list()
 
  from openstackclient_base.keystone.client import IdentityPublicClient
  print IdentityPublicClient(http_client).tenants.list()
 
 
 
  ___
  Mailing list: https://launchpad.net/~openstack
  Post to : openstack@lists.launchpad.net
  Unsubscribe : https://launchpad.net/~openstack
  More help   : https://help.launchpad.net/ListHelp

 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp




-- 
Alessio Ababilov
Software Engineer
Grid Dynamics
___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


[Openstack] Common openstack client library

2012-06-19 Thread Alexey Ababilov
Hi!

Unfortunately, nova, keystone, and glance clients are very inconsistent. A
lot of code is copied between all these clients instead of moving it to a
common library. The code was edited without synchronization between
clients, so, they have different behaviour:

   - all client constructors use different parameters (api_key in nova or
   password in keystone and so on);
   - keystoneclient authenticates immediately in __init__, while novaclient
   does in lazily during first method call;
   - {keystone,nova}client can manage service catalogs and accept
   keystone's auth URI while glanceclient allows endpoints only;
   - keystoneclient can support authorization with an unscoped token but
   novaclient doesn't;
   - novaclient uses class composition while keystoneclient uses
   inheritance.

I have developed a library to unify current clients. The library can be
used as-is, but it would be better if openstack clients dropped their
common code (base.py, exceptions.py and so on) and just began to import
common code.

Here is an example of using unified clients.

from openstackclient_base import patch_clients
from openstackclient_base.client import HttpClient
http_client = HttpClient(username=..., password=...,
tenant_name=..., auth_uri=...)

from openstackclient_base.nova.client import ComputeClient
print ComputeClient(http_client).servers.list()

from openstackclient_base.keystone.client import IdentityPublicClient
print IdentityPublicClient(http_client).tenants.list()
___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Common openstack client library

2012-06-19 Thread Joseph Heck
Alexey - 

where's the library of common that you've put together? Is it committed to 
openstack-common? somewhere else?

-joe

On Jun 19, 2012, at 9:43 AM, Alexey Ababilov wrote:
 Unfortunately, nova, keystone, and glance clients are very inconsistent. A 
 lot of code is copied between all these clients instead of moving it to a 
 common library. The code was edited without synchronization between clients, 
 so, they have different behaviour:
 
 all client constructors use different parameters (api_key in nova or password 
 in keystone and so on);
 keystoneclient authenticates immediately in __init__, while novaclient does 
 in lazily during first method call;
 {keystone,nova}client can manage service catalogs and accept keystone's auth 
 URI while glanceclient allows endpoints only;
 keystoneclient can support authorization with an unscoped token but 
 novaclient doesn't;
 novaclient uses class composition while keystoneclient uses inheritance.
 I have developed a library to unify current clients. The library can be used 
 as-is, but it would be better if openstack clients dropped their common code 
 (base.py, exceptions.py and so on) and just began to import common code.
 
 Here is an example of using unified clients.
 from openstackclient_base import patch_clients
 from openstackclient_base.client import HttpClient
 http_client = HttpClient(username=..., password=..., tenant_name=..., 
 auth_uri=...)
 
 from openstackclient_base.nova.client import ComputeClient
 print ComputeClient(http_client).servers.list()
 
 from openstackclient_base.keystone.client import IdentityPublicClient
 print IdentityPublicClient(http_client).tenants.list()
 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Common openstack client library

2012-06-19 Thread Jay Pipes

Did you see:

https://github.com/openstack/python-openstackclient

Also, keep in mind that some of the ways the existing Glance client (and 
Swift client FTM) work is due to lack of support in httplib2 for 
chunked-transfer encoding.


Best,
-jay

On 06/19/2012 12:43 PM, Alexey Ababilov wrote:

Hi!

Unfortunately, nova, keystone, and glance clients are very inconsistent.
A lot of code is copied between all these clients instead of moving it
to a common library. The code was edited without synchronization between
clients, so, they have different behaviour:

  * all client constructors use different parameters (api_key in nova or
password in keystone and so on);
  * keystoneclient authenticates immediately in __init__, while
novaclient does in lazily during first method call;
  * {keystone,nova}client can manage service catalogs and accept
keystone's auth URI while glanceclient allows endpoints only;
  * keystoneclient can support authorization with an unscoped token but
novaclient doesn't;
  * novaclient uses class composition while keystoneclient uses inheritance.

I have developed a library to unify current clients. The library can be
used as-is, but it would be better if openstack clients dropped their
common code (base.py, exceptions.py and so on) and just began to import
common code.

Here is an example of using unified clients.

from openstackclient_base import patch_clients
from openstackclient_base.client import HttpClient
http_client = HttpClient(username=..., password=..., tenant_name=..., 
auth_uri=...)

from openstackclient_base.nova.client import ComputeClient
print ComputeClient(http_client).servers.list()

from openstackclient_base.keystone.client import IdentityPublicClient
print IdentityPublicClient(http_client).tenants.list()



___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp


Re: [Openstack] Common openstack client library

2012-06-19 Thread Monty Taylor
Hi!

On 06/19/2012 09:43 AM, Alexey Ababilov wrote:
 Hi!
 
 Unfortunately, nova, keystone, and glance clients are very inconsistent.
 A lot of code is copied between all these clients instead of moving it
 to a common library. The code was edited without synchronization between
 clients, so, they have different behaviour:
 
   * all client constructors use different parameters (api_key in nova or
 password in keystone and so on);
   * keystoneclient authenticates immediately in __init__, while
 novaclient does in lazily during first method call;
   * {keystone,nova}client can manage service catalogs and accept
 keystone's auth URI while glanceclient allows endpoints only;
   * keystoneclient can support authorization with an unscoped token but
 novaclient doesn't;
   * novaclient uses class composition while keystoneclient uses inheritance.
 
 I have developed a library to unify current clients. The library can be
 used as-is, but it would be better if openstack clients dropped their
 common code (base.py, exceptions.py and so on) and just began to import
 common code.

There are two projects already in work focused on various aspects of
this. openstack-common is the place that we put code that should be
shared between the clients. python-openstackclient is a project that
aims at a single consistent interface.

I'm thrilled that you have done some work in this area, but it would be
great if you could do this in the context of the two fairly official
projects that already exist.

Thanks!
Monty


 Here is an example of using unified clients.
 
 from openstackclient_base import patch_clients
 from openstackclient_base.client import HttpClient
 http_client = HttpClient(username=..., password=..., tenant_name=..., 
 auth_uri=...)
 
 from openstackclient_base.nova.client import ComputeClient
 print ComputeClient(http_client).servers.list()
 
 from openstackclient_base.keystone.client import IdentityPublicClient
 print IdentityPublicClient(http_client).tenants.list()
 
 
 
 ___
 Mailing list: https://launchpad.net/~openstack
 Post to : openstack@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~openstack
 More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help   : https://help.launchpad.net/ListHelp