← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1726213] Re: KNOWN_EXCEPTIONS don't include all possible exceptions

 

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 <jiangpengcheng@xxxxxxxxxxxxx>
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 <jiangpengcheng@xxxxxxxxxxxxx>
    Co-authored-by: Brian Rosmaita <rosmaita.fossdev@xxxxxxxxx>
    
    Closes-Bug: #1726213
    
    Change-Id: Iabfc2ded45a576a18bdb30a6c3ada8b9799a3196


** Changed in: glance
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1726213

Title:
  KNOWN_EXCEPTIONS don't include all possible exceptions

Status in Glance:
  Fix Released
Status in Glance queens series:
  Triaged

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

  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1726213/+subscriptions


References