From cd549d2c07143aa41e67c2fa33017c6e0921d5b6 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Tue, 29 Apr 2014 15:22:20 -0700 Subject: [PATCH] Don't print duplicate messages on SystemExit 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 | 6 +++--- neutron/agent/linux/dhcp.py | 4 ++-- neutron/plugins/ml2/managers.py | 2 +- neutron/plugins/mlnx/agent/utils.py | 2 +- neutron/services/loadbalancer/plugin.py | 2 +- neutron/services/service_base.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index aa7f7b782..8adf9b591 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -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 diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index 08690e837..59a2d7ad1 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -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.""" diff --git a/neutron/plugins/ml2/managers.py b/neutron/plugins/ml2/managers.py index a5feb7040..13df6732e 100644 --- a/neutron/plugins/ml2/managers.py +++ b/neutron/plugins/ml2/managers.py @@ -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): diff --git a/neutron/plugins/mlnx/agent/utils.py b/neutron/plugins/mlnx/agent/utils.py index 654ba8fb7..cfed16569 100644 --- a/neutron/plugins/mlnx/agent/utils.py +++ b/neutron/plugins/mlnx/agent/utils.py @@ -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 diff --git a/neutron/services/loadbalancer/plugin.py b/neutron/services/loadbalancer/plugin.py index a95e65841..51e0e3f39 100644 --- a/neutron/services/loadbalancer/plugin.py +++ b/neutron/services/loadbalancer/plugin.py @@ -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: diff --git a/neutron/services/service_base.py b/neutron/services/service_base.py index 100979b9a..5d8e8fc86 100644 --- a/neutron/services/service_base.py +++ b/neutron/services/service_base.py @@ -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: -- 2.45.2