From 25015daded167c045710c0d372f4ad2452967d82 Mon Sep 17 00:00:00 2001 From: Anton Arefiev Date: Thu, 2 Feb 2017 13:07:22 +0200 Subject: [PATCH] Trivial: improve logging in FSM transition Logging function name and module where it is located if exception is raised during fsm transition. It helps to find out the cause faster. Change-Id: I2b07333420a53b7c83ea4fd99332b5e444bfc8c1 --- ironic_inspector/node_cache.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ironic_inspector/node_cache.py b/ironic_inspector/node_cache.py index 10a29a114..00eb7f966 100644 --- a/ironic_inspector/node_cache.py +++ b/ironic_inspector/node_cache.py @@ -26,6 +26,7 @@ from oslo_config import cfg from oslo_db import exception as db_exc from oslo_db.sqlalchemy import utils as db_utils from oslo_utils import excutils +from oslo_utils import reflection from oslo_utils import timeutils from oslo_utils import uuidutils from sqlalchemy.orm import exc as orm_errors @@ -523,14 +524,16 @@ def triggers_fsm_error_transition(errors=(Exception,), except no_errors as exc: LOG.debug('Not processing error event for the ' 'exception: %(exc)s raised by %(func)s', - {'exc': exc, 'func': func}, node_info=node_info) + {'exc': exc, + 'func': reflection.get_callable_name(func)}, + node_info=node_info) except errors as exc: with excutils.save_and_reraise_exception(): LOG.error(_LE('Processing the error event because of an ' 'exception %(exc_type)s: %(exc)s raised by ' '%(func)s'), {'exc_type': type(exc), 'exc': exc, - 'func': func}, + 'func': reflection.get_callable_name(func)}, node_info=node_info) # an error event should be possible from all states node_info.fsm_event(istate.Events.error)