[Openstack] Common openstack client library

Monty Taylor mordred at inaugust.com
Tue Jun 19 17:14:36 UTC 2012


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 at lists.launchpad.net
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp




More information about the Openstack mailing list