Misleading msg in barbican log when using a new tenant

Bug #1347205 reported by Steve Heyman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Barbican
Fix Released
Low
Steve Heyman

Bug Description

Running tests for a new tenant ID (ie one that Barbican has never seen) causes the following message in the barbican logs:

2014-07-22 21:15:15.551 25227 ERROR barbican.model.repositories [-] Problem getting Tenant 089f9b9a71e947c9a7e6b538684351f1
2014-07-22 21:15:15.551 25227 TRACE barbican.model.repositories Traceback (most recent call last):
2014-07-22 21:15:15.551 25227 TRACE barbican.model.repositories File "/opt/stack/new/barbican/barbican/model/repositories.py", line 507, in find_by_keystone_id
2014-07-22 21:15:15.551 25227 TRACE barbican.model.repositories entity = query.one()
2014-07-22 21:15:15.551 25227 TRACE barbican.model.repositories File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2316, in one
2014-07-22 21:15:15.551 25227 TRACE barbican.model.repositories raise orm_exc.NoResultFound("No row was found for one()")
2014-07-22 21:15:15.551 25227 TRACE barbican.model.repositories NoResultFound: No row was found for one()
2014-07-22 21:15:15.551 25227 TRACE barbican.model.repositories

This is an expected behaviour - server is looking to see if the tenant is known...if not it will add it.

The problem is that someone (or a log scanning tool) could see this as a potential issue in the barbican server and cause unnecessary alarm.

The code that raises this has a flag (suppress_exception) which handles the actual percolation of the exception, but it doesn't cover the LOGging.

Should move the code to log this so that it is NOT logged when the exception is expected (try saying that 10 times fast!)

See barbican.model.repositories.find_by_keystone_id()

Steve Heyman (sheyman)
Changed in barbican:
status: New → Confirmed
importance: Undecided → Low
milestone: none → juno-3
Changed in barbican:
assignee: nobody → Steve Heyman (sheyman)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to barbican (master)

Reviewed: https://review.openstack.org/109037
Committed: https://git.openstack.org/cgit/openstack/barbican/commit/?id=ed5eab5f53e26700ee9e78249f5840440405703e
Submitter: Jenkins
Branch: master

commit ed5eab5f53e26700ee9e78249f5840440405703e
Author: Steve Heyman <email address hidden>
Date: Wed Jul 23 11:40:32 2014 -0500

    Don't log message for keystone ID query when supressing exceptions

    Barbican repo method find_by_keystone_id will check the DB for a
    tenant ID. It also takes a flag, supress_exception, so that a
    "tenant not found" type of error won't result in an exception
    being percolated to its caller.

    When the query is done for a tenant that has never been used
    it will raise a NoResultFound which gets caught and only
    percolated if the supress_exception flag is false.

    Previous to this change, we would log this NoResultFound which
    in many cases is expected behaviour (hence the supress_exception
    flag). This could be confusing for someone looking at barbican
    logs (or an automated log crawler) since this exception is actually
    expected behaviour.

    This change moves the logging of the exception so that it only
    happens if the supress_exception flag is false. This keeps these
    expected exceptions out of the logs.

    Change-Id: I864ab7db19efb2230f43c9287103b97fa7b16beb
    Closes-Bug: 1347205

Changed in barbican:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in barbican:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in barbican:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.