File name not logged when there is an error loading a metadef file

Bug #1483049 reported by Deepti Ramakrishna
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Deepti Ramakrishna

Bug Description

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. The UI silently ignores files that failed to load. This makes it very hard to know why the new metadata properties are not showing up in the UI. Printing the file name in the error message will make it easier to debug since the developer can now search the log for the new file name.

REPRO:
 1) Add a new json file, say data-security.json, containing some error in the glance/etc/metadefs directory. Sample file: http://paste.openstack.org/show/uq3OdbnC4oxJOv5SRpQG/. Note that it is missing a comma at the end of line 14.
 2) Run devstack by typing ./stack.sh. Examine the devstack log printed to the screen after it is done (you need to scroll up quite a bit).

EXPECTED:
Devstack log contains the file name along with error message.

2015-08-09 11:48:34.875 ERROR glance.db.sqlalchemy.metadata [-] File /etc/glance/metadefs/data-security.json: Expecting , delimiter: line 15 column 9 (char 579)

ACTUAL:
Devstack log does NOT contain the file name, only the error message.

2015-08-09 11:48:34.875 ERROR glance.db.sqlalchemy.metadata [-] Expecting , delimiter: line 15 column 9 (char 579)

Changed in glance:
assignee: nobody → Deepti Ramakrishna (dramakri)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/210879

Changed in glance:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/210879
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=e37cb511f25a709ea766f1de5d28b8e67e1b79e0
Submitter: Jenkins
Branch: master

commit e37cb511f25a709ea766f1de5d28b8e67e1b79e0
Author: Deepti Ramakrishna <email address hidden>
Date: Sun Aug 9 18:02:57 2015 -0700

    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

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/glance 12.0.0.0b1

This issue was fixed in the openstack/glance 12.0.0.0b1 development milestone.

Changed in glance:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.