KNOWN_EXCEPTIONS don't include all possible exceptions

Bug #1726213 reported by raja
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Brian Rosmaita
Queens
Triaged
High
Brian Rosmaita

Bug Description

oslo.config may raise a ConfigFileValueError when run server.start(***) in `glance/cmd/api.py`, which is a subclass of ValueError so it can be caught using KNOWN_EXCEPTIONS.

But ConfigFileValueError is not in the KNOWN_EXCEPTIONS, use index method of KNOWN_EXCEPTIONS will raise an ValueError, which is unexpected:

```
2017-10-22 22:47:46.460 94 CRITICAL glance [-] Unhandled error: ValueError: tuple.index(x): x not in tuple
2017-10-22 22:47:46.460 94 ERROR glance Traceback (most recent call last):
2017-10-22 22:47:46.460 94 ERROR glance File "/var/lib/kolla/venv/bin/glance-api", line 10, in <module>
2017-10-22 22:47:46.460 94 ERROR glance sys.exit(main())
2017-10-22 22:47:46.460 94 ERROR glance File "/var/lib/kolla/venv/lib/python2.7/site-packages/glance/cmd/api.py", line 92, in main
2017-10-22 22:47:46.460 94 ERROR glance fail(e)
2017-10-22 22:47:46.460 94 ERROR glance File "/var/lib/kolla/venv/lib/python2.7/site-packages/glance/cmd/api.py", line 65, in fail
2017-10-22 22:47:46.460 94 ERROR glance return_code = KNOWN_EXCEPTIONS.index(type(e)) + 1
2017-10-22 22:47:46.460 94 ERROR glance ValueError: tuple.index(x): x not in tuple
2017-10-22 22:47:46.460 94 ERROR glance

```

raja (jiangpch)
Changed in glance:
assignee: nobody → raja (jiangpch)
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/514114

Changed in glance:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance (master)

Change abandoned by jiangpch (<email address hidden>) on branch: master
Review: https://review.openstack.org/514114

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

Upping the priority as it's impacting interoperable image import configuration. See comments on the duplicate bug.

Changed in glance:
assignee: raja (jiangpch) → Brian Rosmaita (brian-rosmaita)
importance: Undecided → High
milestone: none → rocky-1
tags: added: queens-backport-potential
tags: removed: queens-backport-potential
Changed in glance:
milestone: rocky-1 → rocky-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/514114
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=7edf7ff66dd16d716c7b4935738ccb15f0a83aaf
Submitter: Zuul
Branch: master

commit 7edf7ff66dd16d716c7b4935738ccb15f0a83aaf
Author: jiangpch <email address hidden>
Date: Sun Oct 22 23:17:35 2017 -0400

    Refactor exception handling in cmd.api

    Replace the known exception tuple with a map of exception classes
    to error codes to preserve backward compatibility of exit codes.
    Also change the code to handle unknown members of the Exception
    hierarchy without breaking.

    Co-authored-by: jiangpch <email address hidden>
    Co-authored-by: Brian Rosmaita <email address hidden>

    Closes-Bug: #1726213

    Change-Id: Iabfc2ded45a576a18bdb30a6c3ada8b9799a3196

Changed in glance:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 17.0.0.0b2

This issue was fixed in the openstack/glance 17.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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