From 8fda2fe288a0668a19abe1a4a231b1a27ac69bad Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Mon, 3 Mar 2014 19:43:16 -0600 Subject: [PATCH] Log tracebacks caught in fileserver updates When a traceback is triggered in a fileserver update, it is caught and printed. However, all that is printed is the result of exc.__str__(), which is not helpful when debugging, and makes it harder to track down fileserver update issues. This commit changes the behavior and writes the full text of the exception to the master log. --- salt/daemons/masterapi.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/salt/daemons/masterapi.py b/salt/daemons/masterapi.py index 7bd4d94b5f..44a5b536c5 100644 --- a/salt/daemons/masterapi.py +++ b/salt/daemons/masterapi.py @@ -38,6 +38,7 @@ import salt.utils.event import salt.utils.verify import salt.utils.minions import salt.utils.gzip_util +import traceback from salt.utils.event import tagify from salt.exceptions import SaltMasterError @@ -154,9 +155,10 @@ def fileserver_update(fileserver): 'able to serve files to minions') raise SaltMasterError('No fileserver backends available') fileserver.update() - except Exception as exc: + except Exception: log.error( - 'Exception {0} occurred in file server update'.format(exc) + 'Exception occurred in file server update:\n{0}' + .format(traceback.format_exc()) )