yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #07741
[Bug 1264052] [NEW] Optimize code, delete a try statement
Public bug reported:
The method serve_wsgi() in /neutron/neutron/service.py have two try statemens to capture exceptions,as follows:
def serve_wsgi(cls):
try:
try:
service = cls.create()
service.start()
except RuntimeError:
LOG.exception(_('Error occurred: trying old api-paste.ini.'))
service = cls.create('quantum')
service.start()
except Exception:
LOG.exception(_('Unrecoverable error: please check log for details.'))
raise
it can be optimized and modified as:
def serve_wsgi(cls):
try:
service = cls.create()
service.start()
except RuntimeError:
LOG.exception(_('Error occurred: trying old api-paste.ini.'))
service = cls.create('quantum')
service.start()
except Exception:
LOG.exception(_('Unrecoverable error: please check log for details.'))
raise
return service
** Affects: glance
Importance: Undecided
Assignee: Haojie Jia (jiahaojie)
Status: New
** Changed in: glance
Assignee: (unassigned) => Haojie Jia (jiahaojie)
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1264052
Title:
Optimize code, delete a try statement
Status in OpenStack Image Registry and Delivery Service (Glance):
New
Bug description:
The method serve_wsgi() in /neutron/neutron/service.py have two try statemens to capture exceptions,as follows:
def serve_wsgi(cls):
try:
try:
service = cls.create()
service.start()
except RuntimeError:
LOG.exception(_('Error occurred: trying old api-paste.ini.'))
service = cls.create('quantum')
service.start()
except Exception:
LOG.exception(_('Unrecoverable error: please check log for details.'))
raise
it can be optimized and modified as:
def serve_wsgi(cls):
try:
service = cls.create()
service.start()
except RuntimeError:
LOG.exception(_('Error occurred: trying old api-paste.ini.'))
service = cls.create('quantum')
service.start()
except Exception:
LOG.exception(_('Unrecoverable error: please check log for details.'))
raise
return service
To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1264052/+subscriptions
Follow ups
References