Add error message to the logs

This commit is contained in:
sayali 2020-09-22 18:46:15 -07:00
parent 9211178e77
commit 921e8d8236
1 changed files with 8 additions and 5 deletions

View File

@ -6,9 +6,12 @@ the algorithm is determined based on the key length. For rest of the keys,
the certificate body is parsed to determine the exact key type information. the certificate body is parsed to determine the exact key type information.
Each individual change is explicitly committed. The logs are added to file Each individual change is explicitly committed. The logs are added to file
named upgrade_logs in current working directory. If faced any issue while named db_upgrade.log in current working directory. Any error encountered
running this upgrade, there is no harm in re-running the upgrade. Each run while parsing a certificate will also be logged along with the certificate
processes only the keys for which key type information is not yet determined. ID. If faced any issue while running this upgrade, there is no harm in
re-running the upgrade. Each run processes only the keys for which key type
information is not yet determined.
A successful end to end run will end up updating the Alembic Version to new A successful end to end run will end up updating the Alembic Version to new
Revision ID c301c59688d2. Currently only RSA and ECC certificates are supported Revision ID c301c59688d2. Currently only RSA and ECC certificates are supported
by Lemur. This could be a long running job depending upon the number of by Lemur. This could be a long running job depending upon the number of
@ -89,8 +92,8 @@ def update_key_type():
): ):
try: try:
cert_key_type = utils.get_key_type_from_certificate(body) cert_key_type = utils.get_key_type_from_certificate(body)
except ValueError: except ValueError as e:
log_file.write("Error in processing certificate. ID: %s\n" % cert_id) log_file.write("Error in processing certificate - ID: %s Error: %s \n" % (cert_id, str(e)))
else: else:
log_file.write("Processing certificate - ID: %s key_type: %s\n" % (cert_id, cert_key_type)) log_file.write("Processing certificate - ID: %s key_type: %s\n" % (cert_id, cert_key_type))
stmt = text( stmt = text(