Improve secrets_manager logging after 500 Internal Server Error

This is to add better logging to assist with debugging 500
Internal Server Errors that manifest from either internal
bugs in Deckhand or document typos/errors ingested by Deckhand
during document substitution.

Change-Id: I5f4c1cb07bea8e6546d08a858d4f83a24d75ef5a
This commit is contained in:
Felipe Monteiro 2018-03-10 16:39:48 -05:00
parent a07635c6a4
commit 65c459d1f9
2 changed files with 18 additions and 3 deletions

View File

@ -278,13 +278,26 @@ class SecretsSubstitution(object):
LOG.error(message)
raise errors.UnknownSubstitutionError(details=message)
except errors.BarbicanException as e:
LOG.error('Failed to resolve a Barbican reference.')
LOG.error('Failed to resolve a Barbican reference for '
'substitution source document [%s] %s referenced'
' in document [%s] %s. Details: %s', src_schema,
src_name, document.schema, document.name,
e.format_message())
raise errors.UnknownSubstitutionError(
src_schema=src_schema, src_name=src_name,
document_name=document.name,
document_schema=document.schema,
details=e.format_message())
except Exception as e:
LOG.error('Unexpected exception occurred while attempting '
'secret substitution. %s', six.text_type(e))
'substitution using source document [%s] %s '
'referenced in [%s] %s. Details: %s', src_schema,
src_name, document.schema, document.name,
six.text_type(e))
raise errors.UnknownSubstitutionError(
src_schema=src_schema, src_name=src_name,
document_name=document.name,
document_schema=document.schema,
details=six.text_type(e))
yield document

View File

@ -385,5 +385,7 @@ class UnknownSubstitutionError(DeckhandException):
**Troubleshoot:**
"""
msg_fmt = ('An unknown exception occurred while trying to perform '
'substitution. Details: %(details)s')
'substitution using source document [%(src_schema)s] '
'%(src_name)s contained in document [%(document_schema)s] '
'%(document_name)s. Details: %(details)s')
code = 500