diff options
author | Yves-Gwenael Bourhis <yves-gwenael.bourhis@cloudwatt.com> | 2013-10-01 14:58:30 +0200 |
---|---|---|
committer | Akihiro Motoki <motoki@da.jp.nec.com> | 2013-12-20 19:59:55 +0900 |
commit | 6801ec1db31eb6b486b7f778b5ac8d689b52e0c2 (patch) | |
tree | e48e4c4a7019b1f5052db939ebc88d07bc2fe029 | |
parent | 3e93b54fe88449c358ed7a50059c87c682ea350f (diff) | |
download | horizon-6801ec1db31eb6b486b7f778b5ac8d689b52e0c2.tar.gz |
Common keystone version fallback
If OPENSTACK_API_VERSIONS["identity"] was not set in local_settings.py,
django_openstack_auth and horizon had their own fallback method which
did not necessarily fallback on the same version and was leading to
discrepancies and erratic behavior.
Refactored in order to use the same fallback method defined in
django_openstack_auth.utils
Change-Id: I583d49a73077a20baf5f01628b0b6e8480296964
Closes-Bug: #1231357
(cherry picked from commit ea447939a88dd80e54612a49a66ae57243e1164b)
-rw-r--r-- | openstack_dashboard/api/keystone.py | 4 | ||||
-rw-r--r-- | openstack_dashboard/test/settings.py | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py index 3a178648b..83abedf6d 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py @@ -28,6 +28,7 @@ from django.utils.translation import ugettext_lazy as _ # noqa from keystoneclient import exceptions as keystone_exceptions from openstack_auth import backend +from openstack_auth import utils as auth_utils from horizon import exceptions from horizon import messages @@ -56,7 +57,8 @@ class IdentityAPIVersionManager(base.APIVersionManager): return manager -VERSIONS = IdentityAPIVersionManager("identity", preferred_version=3) +VERSIONS = IdentityAPIVersionManager( + "identity", preferred_version=auth_utils.get_keystone_version()) # Import from oldest to newest so that "preferred" takes correct precedence. diff --git a/openstack_dashboard/test/settings.py b/openstack_dashboard/test/settings.py index 85f470daf..627f4f2ab 100644 --- a/openstack_dashboard/test/settings.py +++ b/openstack_dashboard/test/settings.py @@ -80,6 +80,10 @@ AVAILABLE_REGIONS = [ ('http://remote:5000/v2.0', 'remote'), ] +OPENSTACK_API_VERSIONS = { + "identity": 3 +} + OPENSTACK_KEYSTONE_URL = "http://localhost:5000/v2.0" OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member" |