[Yahoo-eng-team] [Bug 1726213] Re: KNOWN_EXCEPTIONS don't include all possible exceptions

2018-06-07 Thread OpenStack Infra
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 
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 
Co-authored-by: Brian Rosmaita 

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 
  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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp


[Yahoo-eng-team] [Bug 1726213] Re: KNOWN_EXCEPTIONS don't include all possible exceptions

2018-04-11 Thread Brian Rosmaita
** Also affects: glance/queens
   Importance: Undecided
   Status: New

** Changed in: glance/queens
Milestone: None => queens-stable-2

** Changed in: glance/queens
   Importance: Undecided => High

** Changed in: glance/queens
   Status: New => Triaged

** Changed in: glance/queens
 Assignee: (unassigned) => Brian Rosmaita (brian-rosmaita)

** Tags removed: queens-backport-potential

-- 
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:
  In Progress
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 
  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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp