tripleo-container-image-prepare/logging: fix exception formating

It happens that the remote registry returns 401 and we want to log an
exception but the formating wasn't converted to strings.
So we had this error:

  TypeError: not all arguments converted during string formatting

With this patch, we use {} code and the .format method to make sure that
the exception will be composed of strings only.

Note: it doesn't fix the root cause of the 401 error reported in bug 1819632
but it should help to figure it out with proper logging.

Change-Id: Idad301b6da30143827da1cfc8083f460073442fe
Related-Bug: #1819632
This commit is contained in:
Emilien Macchi 2019-03-12 08:58:40 -04:00
parent 3f5b75bd47
commit d6abcac8dc

View File

@ -133,4 +133,4 @@ if __name__ == '__main__':
log.info(result)
print(result)
except Exception as e:
log.exception('Image prepare failed', e)
log.exception("Image prepare failed: {}".format(e))