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: neutron Importance: Undecided Assignee: Haojie Jia (jiahaojie) Status: New ** Changed in: neutron Assignee: (unassigned) => Haojie Jia (jiahaojie) -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1264054 Title: Optimize code, delete a try statement Status in OpenStack Neutron (virtual network service): 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/neutron/+bug/1264054/+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