Show the file name when there is an error loading an image metadef file
New image metadata can be added by creating a new json file in the directory glance/etc/metadefs (this metadata shows up in the image metadata UI on Horizon dashboard). If the file is loaded successfully, a log message like the following is printed: 2015-08-09 11:48:34.713 INFO glance.db.sqlalchemy.metadata [-] File /etc/glance/metadefs/operating-system.json loaded to database. However, if there is an error loading the file, we get a log message like: 2015-08-09 11:48:34.875 ERROR glance.db.sqlalchemy.metadata [-] Expecting , delimiter: line 15 column 9 (char 579) In other words, the file name is not printed. Printing the file name in the error message will make it easier to debug as we can search the logs using the file name. Change-Id: If72fdbb00c58e42aa128ab2b4461a2ae8e55c5aa Closes-Bug: #1483049
This commit is contained in:
parent
f85857e167
commit
e37cb511f2
|
@ -212,7 +212,10 @@ def _populate_metadata(meta, metadata_path=None, merge=False,
|
|||
with open(file) as json_file:
|
||||
metadata = json.load(json_file)
|
||||
except Exception as e:
|
||||
LOG.error(encodeutils.exception_to_unicode(e))
|
||||
LOG.error(_LE("Failed to parse json file %(file_path)s while "
|
||||
"populating metadata due to: %(error_msg)s"),
|
||||
{"file_path": file,
|
||||
"error_msg": encodeutils.exception_to_unicode(e)})
|
||||
continue
|
||||
|
||||
values = {
|
||||
|
|
Loading…
Reference in New Issue