From 55baf9254d78de2c6e409156e6649875cb7797e3 Mon Sep 17 00:00:00 2001 From: Kam Nasim Date: Wed, 2 Nov 2016 19:34:40 +0000 Subject: [PATCH] "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 Closes-Bug: #1638662 Change-Id: Iadd5184a16a73da1da5a7230c89e996248f1eba7 --- openstack_dashboard/api/keystone.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py index df308cf973..c4cec21300 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py @@ -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,