From 8e13106adb03f8d6ac614a136edcd4f653847cf6 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Fri, 15 Mar 2019 09:15:28 +0100 Subject: [PATCH] Make domain_lookup return consistent type It is possible to make Horizon reach the "Pure project admin doesn't have a domain token" state in domain_lookup by having different policy files in Keystone and in Horizon, at which point it results in an unhelpful AttributeError later on, because domain_lookup returns None. I'm proposing to make it return an empty dict instead, this way Horizon doesn't crash, but we still get the warning in the logs. Change-Id: I7a42e8defb2fb348cac8225fb1dcbf5e86c9e65c --- openstack_dashboard/api/keystone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py index bc0d7bf966..fa4cbf289c 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py @@ -247,7 +247,7 @@ def domain_lookup(request): return dict((d.id, d.name) for d in domains) except Exception: LOG.warning("Pure project admin doesn't have a domain token") - return None + return {} else: domain = get_default_domain(request) return {domain.id: domain.name}