summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Kunz <georg.kunz@ericsson.com>2018-01-29 16:24:48 +0100
committerGeorg Kunz <georg.kunz@ericsson.com>2018-01-30 07:54:29 +0000
commitfd18b6790cd9b59851bce6746cc83f27d3e18e4f (patch)
treed60e180db20a12797bae4dbccaa480f11814bcfa
parent2a09f4166562c1a91410a246d4ab08f0d5d71039 (diff)
Avoid checking Keystone v3 domains when using API v2.0stable/euphrates
Introducing a version check to avoid checking keystone domains, which are an auth API v3 feature, when only auth API v2.0 is being used. Change-Id: I220c6637e5f65124e5dbe7d5246490c3986b7a66 Signed-off-by: Georg Kunz <georg.kunz@ericsson.com>
-rw-r--r--snaps/openstack/utils/keystone_utils.py7
-rw-r--r--snaps/openstack/utils/tests/keystone_utils_tests.py7
2 files changed, 9 insertions, 5 deletions
diff --git a/snaps/openstack/utils/keystone_utils.py b/snaps/openstack/utils/keystone_utils.py
index b36c19f..1769e77 100644
--- a/snaps/openstack/utils/keystone_utils.py
+++ b/snaps/openstack/utils/keystone_utils.py
@@ -374,9 +374,10 @@ def get_domain_by_id(keystone, domain_id):
:param domain_id: the domain ID to retrieve
:return: the SNAPS-OO Domain domain object
"""
- domain = keystone.domains.get(domain_id)
- if domain:
- return Domain(name=domain.name, domain_id=domain.id)
+ if keystone.version != V2_VERSION_STR:
+ domain = keystone.domains.get(domain_id)
+ if domain:
+ return Domain(name=domain.name, domain_id=domain.id)
def __get_os_domain_by_name(keystone, domain_name):
diff --git a/snaps/openstack/utils/tests/keystone_utils_tests.py b/snaps/openstack/utils/tests/keystone_utils_tests.py
index bd0086b..75bd6b3 100644
--- a/snaps/openstack/utils/tests/keystone_utils_tests.py
+++ b/snaps/openstack/utils/tests/keystone_utils_tests.py
@@ -124,8 +124,11 @@ class KeystoneUtilsTests(OSComponentTestCase):
domain = keystone_utils.get_domain_by_id(
self.keystone, project.domain_id)
- self.assertIsNotNone(domain)
- self.assertEqual(domain.id, project.domain_id)
+ if self.keystone.version == keystone_utils.V2_VERSION_STR:
+ self.assertIsNone(domain)
+ else:
+ self.assertIsNotNone(domain)
+ self.assertEqual(domain.id, project.domain_id)
def test_get_endpoint_success(self):
"""