"Unable to retrieve Domain" incessant warning logs

"openstack_dashboard.api.keystone: Unable to retrieve Domain: default"
incessant warning logging when switching Projects while being on the
Identity>Project panel.

Retrieving domain information is a Keystone admin URL operation. As a
pre-check, such operations would be Forbidden if the logon user does not
have an 'admin' role on the current project.

Since this is a common occurence, and can cause incessant warning
logging in the horizon logs, we recognize this condition and return the
user's domain information instead.

Signed-off-by: Kam Nasim <kam.nasim@windriver.com>

Closes-Bug: #1638662
Change-Id: Iadd5184a16a73da1da5a7230c89e996248f1eba7
This commit is contained in:
Kam Nasim 2016-11-02 19:34:40 +00:00
parent 32eac39ae6
commit 55baf9254d

View File

@ -273,6 +273,20 @@ def get_default_domain(request, get_name=True):
try:
domain = domain_get(request, domain_id)
domain_name = domain.name
except exceptions.NotAuthorized:
# NOTE (knasim-wrs): Retrieving domain information
# is an admin URL operation. As a pre-check, such
# operations would be Forbidden if the logon user does
# not have an 'admin' role on the current project.
#
# Since this can be a common occurence and can cause
# incessant warning logging in the horizon logs,
# we recognize this condition and return the user's
# domain information instead.
LOG.debug("Cannot retrieve domain information for "
"user (%s) that does not have an admin role "
"on project (%s)" %
(request.user.username, request.user.project_name))
except Exception:
LOG.warning("Unable to retrieve Domain: %s" % domain_id)
domain = base.APIDictWrapper({"id": domain_id,