From 257a51769bb070600ca3d6bc169cf530bd33f1a3 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Thu, 4 Feb 2021 15:37:23 +0900 Subject: [PATCH] Drop meaningless translation marker The translation marker _(..) wrapping a variable is meaningless as no string is extracted and there is no way to translate them. Only rare exception is the same string is defined in somewhere else but I've never seen such situations so far. In addition, we now only support translations in user-visible messages used in API, so we can safely drop translation markers in exceptions in the agent side. Change-Id: Ie1d837d17bf50a4675bec4fe48ab13dde22ebdc2 Related-Bug: #1600788 --- neutron/agent/linux/utils.py | 3 +-- neutron/agent/windows/utils.py | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/neutron/agent/linux/utils.py b/neutron/agent/linux/utils.py index b3a44a9fbf6..e29c770d61d 100644 --- a/neutron/agent/linux/utils.py +++ b/neutron/agent/linux/utils.py @@ -35,7 +35,6 @@ from oslo_utils import excutils from oslo_utils import fileutils import psutil -from neutron._i18n import _ from neutron.common import utils from neutron.conf.agent import common as config from neutron.privileged.agent.linux import utils as priv_utils @@ -142,7 +141,7 @@ def execute(cmd, process_input=None, addl_env=None, if log_fail_as_error: LOG.error(msg) if check_exit_code: - raise exceptions.ProcessExecutionError(_(msg), + raise exceptions.ProcessExecutionError(msg, returncode=returncode) finally: # NOTE(termie): this appears to be necessary to let the subprocess diff --git a/neutron/agent/windows/utils.py b/neutron/agent/windows/utils.py index 0658e3155b3..adf76b2877b 100644 --- a/neutron/agent/windows/utils.py +++ b/neutron/agent/windows/utils.py @@ -25,8 +25,6 @@ from neutron_lib.utils import helpers from oslo_log import log as logging from oslo_utils import encodeutils -from neutron._i18n import _ - if os.name == 'nt': import wmi @@ -133,7 +131,7 @@ def execute(cmd, process_input=None, addl_env=None, LOG.debug(log_msg) if obj.returncode and check_exit_code: - raise exceptions.ProcessExecutionError(_(m), returncode=obj.returncode) + raise exceptions.ProcessExecutionError(m, returncode=obj.returncode) return (_stdout, _stderr) if return_stderr else _stdout