]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Don't emit log for missing attribute check policy
authorSalvatore Orlando <salv.orlando@gmail.com>
Fri, 4 Apr 2014 10:30:12 +0000 (03:30 -0700)
committerMark McClain <mmcclain@yahoo-inc.com>
Fri, 4 Apr 2014 22:53:36 +0000 (18:53 -0400)
A missing policy for validating whether an attribute should
be visible or not is a perfectly normal condition, and
there is no value in logging it.

Writing this information to the log is also having a
considerable performance impact on list operations.

Change-Id: Ie9d3ae6b249a5c49f6d81c1e56915174d8479a07
Closes-Bug: 1302467
(cherry picked from commit ef01fb553a141c012c8d8600edd6b709c5807111)

neutron/api/v2/base.py

index bfd6dcf9db7473e58ce360c091875120e606b2bc..b1df7e0e21ffdc8acbd7b546dead0205271839fe 100644 (file)
@@ -146,10 +146,10 @@ class Controller(object):
                       {'resource': self._collection,
                        'attr': attr_name})
         except exceptions.PolicyRuleNotFound:
-            LOG.debug(_("Policy rule:%(action)s not found. Assuming no "
-                        "authZ check is defined for %(attr)s"),
-                      {'action': action,
-                       'attr': attr_name})
+            # Just ignore the exception. Do not even log it, as this will add
+            # a lot of unnecessary info in the log (and take time as well to
+            # write info to the logger)
+            pass
         attr_val = self._attr_info.get(attr_name)
         return attr_val and attr_val['is_visible'] and authz_check