From 14665f2c9f093fee6630d1f66d2556ddb97f814a Mon Sep 17 00:00:00 2001 From: Thomas Duval Date: Wed, 22 Nov 2017 11:34:18 +0100 Subject: Add more control on Keystone exceptions Change-Id: I1db596b0b7df7344d8cdc40768c7ee6373905c34 --- moonv4/moon_db/moon_db/__init__.py | 2 +- moonv4/moon_db/moon_db/api/policy.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'moonv4/moon_db') diff --git a/moonv4/moon_db/moon_db/__init__.py b/moonv4/moon_db/moon_db/__init__.py index 5eb389d3..515227fa 100644 --- a/moonv4/moon_db/moon_db/__init__.py +++ b/moonv4/moon_db/moon_db/__init__.py @@ -3,5 +3,5 @@ # license which can be found in the file 'LICENSE' in this package distribution # or at 'http://www.apache.org/licenses/LICENSE-2.0'. -__version__ = "1.2.0" +__version__ = "1.2.1" diff --git a/moonv4/moon_db/moon_db/api/policy.py b/moonv4/moon_db/moon_db/api/policy.py index 093d14bd..272872ad 100644 --- a/moonv4/moon_db/moon_db/api/policy.py +++ b/moonv4/moon_db/moon_db/api/policy.py @@ -56,11 +56,16 @@ class PolicyManager(Managers): k_user = Managers.KeystoneManager.create_user(value) if not perimeter_id: try: + LOG.info("k_user={}".format(k_user)) perimeter_id = k_user['users'][0].get('id', uuid4().hex) except IndexError: k_user = Managers.KeystoneManager.get_user_by_name( value.get('name')) perimeter_id = uuid4().hex + except KeyError: + k_user = Managers.KeystoneManager.get_user_by_name( + value.get('name')) + perimeter_id = uuid4().hex value.update(k_user['users'][0]) return self.driver.set_subject(policy_id=policy_id, perimeter_id=perimeter_id, value=value) -- cgit 1.2.3-korg