[Openstack] Finding common version for keystoneauth1 and remote keystone

George Shuklin george.shuklin at gmail.com
Sun Jan 29 23:20:23 UTC 2017


Hello everyone.

I'm working on openstack application. It should works with large range 
of openstacks (at least from Havana till Pica+) and works on large range 
of keystoneauth1 clients (at least from Ubuntu's trusty distro versions 
till Xenial+). I want it to work with any combination of available versions.

I use following steps:

1. Autodiscovery of supported versions:

def _find_local_versions():
         version_filter = partial(re.find, 'v\d+')
         return filter(version_filter, dir(keystoneauth1.identity))

2. Discovery of remote versions:

         r = requests.get(keystone.auth_url)
         versions = map(lambda x: x['id'], r.json()['versions']['values'])

3. Matching them together (plus my own application's list of supported 
versions).

4. Use separate code for 'v2' and 'v3' with auto-conversion between 
'tenant_name' and 'project_name' for keystoneauth1.identity.v2/v3

Is this a proper way to do it? Is here a better way to do this? Thanks.




More information about the Openstack mailing list