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
This commit is contained in:
parent
eb98a12bf0
commit
8e13106adb
|
@ -247,7 +247,7 @@ def domain_lookup(request):
|
||||||
return dict((d.id, d.name) for d in domains)
|
return dict((d.id, d.name) for d in domains)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.warning("Pure project admin doesn't have a domain token")
|
LOG.warning("Pure project admin doesn't have a domain token")
|
||||||
return None
|
return {}
|
||||||
else:
|
else:
|
||||||
domain = get_default_domain(request)
|
domain = get_default_domain(request)
|
||||||
return {domain.id: domain.name}
|
return {domain.id: domain.name}
|
||||||
|
|
Loading…
Reference in New Issue