]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Don't print duplicate messages on SystemExit
authorJoe Gordon <joe.gordon0@gmail.com>
Tue, 29 Apr 2014 22:22:20 +0000 (15:22 -0700)
committerJoe Gordon <joe.gordon0@gmail.com>
Wed, 30 Apr 2014 17:29:01 +0000 (10:29 -0700)
Don't log the error using LOG.error or LOG.exception and then
passing the same string to SystemExit since this will result in the
error being logged twice. Instead log the error and raise SystemExit(1).

Change-Id: I88b6632e6596a36a7168155dd4219e7d55078621

neutron/agent/l3_agent.py
neutron/agent/linux/dhcp.py
neutron/plugins/ml2/managers.py
neutron/plugins/mlnx/agent/utils.py
neutron/services/loadbalancer/plugin.py
neutron/services/service_base.py

index aa7f7b782f28566053112adb9a4f6dc294f0d9ab..8adf9b59194f32ca31e76b81ad45b141934b8ba3 100644 (file)
@@ -206,7 +206,7 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager):
             msg = _("Error importing interface driver "
                     "'%s'") % self.conf.interface_driver
             LOG.error(msg)
-            raise SystemExit(msg)
+            raise SystemExit(1)
 
         self.context = context.get_admin_context_without_session()
         self.plugin_rpc = L3PluginApi(topics.L3PLUGIN, host)
@@ -233,12 +233,12 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager):
         if not self.conf.interface_driver:
             msg = _('An interface driver must be specified')
             LOG.error(msg)
-            raise SystemExit(msg)
+            raise SystemExit(1)
 
         if not self.conf.use_namespaces and not self.conf.router_id:
             msg = _('Router id is required if not using namespaces.')
             LOG.error(msg)
-            raise SystemExit(msg)
+            raise SystemExit(1)
 
     def _cleanup_namespaces(self, routers):
         """Destroy stale router namespaces on host when L3 agent restarts
index 08690e8376461a57bbb4c6f5fdaefbe3343d5967..59a2d7ad185d53ebeb3033b5c1e56669392695f2 100644 (file)
@@ -677,7 +677,7 @@ class DeviceManager(object):
         if not conf.interface_driver:
             msg = _('An interface driver must be specified')
             LOG.error(msg)
-            raise SystemExit(msg)
+            raise SystemExit(1)
         try:
             self.driver = importutils.import_object(
                 conf.interface_driver, conf)
@@ -686,7 +686,7 @@ class DeviceManager(object):
                    "%(inner)s") % {'driver': conf.interface_driver,
                                    'inner': e})
             LOG.error(msg)
-            raise SystemExit(msg)
+            raise SystemExit(1)
 
     def get_interface_name(self, network, port):
         """Return interface(device) name for use by the DHCP process."""
index a5feb70408f7ded5e5d6f277f9a7b15115c5d66c..13df6732e2fce29da6d85b2a67f54542dd6d72e4 100644 (file)
@@ -65,7 +65,7 @@ class TypeManager(stevedore.named.NamedExtensionManager):
                 msg = _("No type driver for tenant network_type: %s. "
                         "Service terminated!") % network_type
                 LOG.error(msg)
-                raise SystemExit(msg)
+                raise SystemExit(1)
         LOG.info(_("Tenant network_types: %s"), self.tenant_network_types)
 
     def initialize(self):
index 654ba8fb72fc2e695bb8d47dab42f7eb0e22c64b..cfed16569ce2a2bfc6fd67079c7e1963af348464 100644 (file)
@@ -32,7 +32,7 @@ class EswitchUtils(object):
             msg = _("Failed to import eventlet.green.zmq. "
                     "Won't connect to eSwitchD - exiting...")
             LOG.error(msg)
-            raise SystemExit(msg)
+            raise SystemExit(1)
         self.__conn = None
         self.daemon = daemon_endpoint
         self.timeout = timeout
index a95e658413940e58712b04c7d6301b1c09367cbf..51e0e3f39be9cb994e1b14421d68a44d6e4a0d09 100644 (file)
@@ -82,7 +82,7 @@ class LoadBalancerPlugin(ldb.LoadBalancerPluginDb,
             msg = _("Delete associated loadbalancer pools before "
                     "removing providers %s") % list(lost_providers)
             LOG.exception(msg)
-            raise SystemExit(msg)
+            raise SystemExit(1)
 
     def _get_driver_for_provider(self, provider):
         if provider in self.drivers:
index 100979b9a4ba32823b3334ea0881be975d9bcb6a..5d8e8fc862a05c30d1b1b487c926fee868b2558d 100644 (file)
@@ -72,7 +72,7 @@ def load_drivers(service_type, plugin):
         msg = (_("No providers specified for '%s' service, exiting") %
                service_type)
         LOG.error(msg)
-        raise SystemExit(msg)
+        raise SystemExit(1)
 
     drivers = {}
     for provider in providers: