From fb5e3908917199810c54ffbdc433e9cd327133b1 Mon Sep 17 00:00:00 2001 From: liyi Date: Tue, 21 Mar 2017 13:01:13 +0800 Subject: [PATCH] Remove log translations Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: I601eee9f1fca65d5fb53e6b75482b74283908a29 --- heatclient/_i18n.py | 10 ---------- heatclient/common/hook_utils.py | 5 ++--- heatclient/common/http.py | 3 +-- heatclient/common/utils.py | 3 +-- heatclient/osc/v1/stack.py | 13 ++++++------- heatclient/v1/shell.py | 26 ++++++++++++-------------- 6 files changed, 22 insertions(+), 38 deletions(-) diff --git a/heatclient/_i18n.py b/heatclient/_i18n.py index 1177be41..f8c62691 100644 --- a/heatclient/_i18n.py +++ b/heatclient/_i18n.py @@ -28,16 +28,6 @@ _translators = oslo_i18n.TranslatorFactory(domain='heatclient') # The primary translation function using the well-known name "_" _ = _translators.primary -# Translators for log levels. -# -# The abbreviated names are meant to reflect the usual use of a short -# name like '_'. The "L" is for "log" and the other letter comes from -# the level. -_LI = _translators.log_info -_LW = _translators.log_warning -_LE = _translators.log_error -_LC = _translators.log_critical - def get_available_languages(): return oslo_i18n.get_available_languages('heatclient') diff --git a/heatclient/common/hook_utils.py b/heatclient/common/hook_utils.py index 66b980a6..e9706908 100644 --- a/heatclient/common/hook_utils.py +++ b/heatclient/common/hook_utils.py @@ -15,7 +15,6 @@ import logging from oslo_utils import fnmatch from heatclient._i18n import _ -from heatclient._i18n import _LE from heatclient import exc logger = logging.getLogger(__name__) @@ -29,8 +28,8 @@ def clear_hook(hc, stack_id, resource_name, hook_type): data={'unset_hook': hook_type}) except exc.HTTPNotFound: logger.error( - _LE("Stack %(stack)s or resource %(resource)s " - "not found for hook %(hook_type)"), + "Stack %(stack)s or resource %(resource)s " + "not found for hook %(hook_type)", {'resource': resource_name, 'stack': stack_id, 'hook_type': hook_type}) diff --git a/heatclient/common/http.py b/heatclient/common/http.py index 68d2908b..f5c50214 100644 --- a/heatclient/common/http.py +++ b/heatclient/common/http.py @@ -28,7 +28,6 @@ import six from six.moves.urllib import parse from heatclient._i18n import _ -from heatclient._i18n import _LW from heatclient.common import utils from heatclient import exc @@ -67,7 +66,7 @@ def get_system_ca_file(): if os.path.exists(ca): LOG.debug("Using ca file %s", ca) return ca - LOG.warning(_LW("System ca file could not be found.")) + LOG.warning("System ca file could not be found.") class HTTPClient(object): diff --git a/heatclient/common/utils.py b/heatclient/common/utils.py index 047b7092..013e6928 100644 --- a/heatclient/common/utils.py +++ b/heatclient/common/utils.py @@ -29,7 +29,6 @@ from six.moves.urllib import request import yaml from heatclient._i18n import _ -from heatclient._i18n import _LE from heatclient import exc LOG = logging.getLogger(__name__) @@ -444,7 +443,7 @@ def get_response_body(resp): try: body = resp.json() except ValueError: - LOG.error(_LE('Could not decode response body as JSON')) + LOG.error('Could not decode response body as JSON') else: body = None return body diff --git a/heatclient/osc/v1/stack.py b/heatclient/osc/v1/stack.py index 26da6139..4a64221a 100644 --- a/heatclient/osc/v1/stack.py +++ b/heatclient/osc/v1/stack.py @@ -24,7 +24,6 @@ import six from six.moves.urllib import request from heatclient._i18n import _ -from heatclient._i18n import _LI from heatclient.common import event_utils from heatclient.common import format_utils from heatclient.common import hook_utils @@ -689,16 +688,16 @@ class DeleteStack(command.Command): _("Are you sure you want to delete this stack(s) [y/N]? ")) prompt_response = sys.stdin.readline().lower() if not prompt_response.startswith('y'): - self.log.info(_LI('User did not confirm stack delete so ' - 'taking no action.')) + self.log.info('User did not confirm stack delete so ' + 'taking no action.') return except KeyboardInterrupt: # ctrl-c - self.log.info(_LI('User did not confirm stack delete ' - '(ctrl-c) so taking no action.')) + self.log.info('User did not confirm stack delete ' + '(ctrl-c) so taking no action.') return except EOFError: # ctrl-d - self.log.info(_LI('User did not confirm stack delete ' - '(ctrl-d) so taking no action.')) + self.log.info('User did not confirm stack delete ' + '(ctrl-d) so taking no action.') return failure_count = 0 diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index a38c32a4..70ffc9f7 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -23,8 +23,6 @@ from six.moves.urllib import request import yaml from heatclient._i18n import _ -from heatclient._i18n import _LI -from heatclient._i18n import _LW from heatclient.common import deployment_utils from heatclient.common import event_utils from heatclient.common import hook_utils @@ -38,8 +36,8 @@ logger = logging.getLogger(__name__) def show_deprecated(deprecated, recommended): - logger.warning(_LW('"%(old)s" is deprecated, ' - 'please use "%(new)s" instead'), + logger.warning('"%(old)s" is deprecated, ' + 'please use "%(new)s" instead', {'old': deprecated, 'new': recommended} ) @@ -105,8 +103,8 @@ def do_stack_create(hc, args): env_paths=args.environment_file, env_list_tracker=env_files_list) if args.create_timeout: - logger.warning(_LW('%(arg1)s is deprecated, ' - 'please use %(arg2)s instead'), + logger.warning('%(arg1)s is deprecated, ' + 'please use %(arg2)s instead', { 'arg1': '-c/--create-timeout', 'arg2': '-t/--timeout'}) @@ -192,8 +190,8 @@ def do_stack_adopt(hc, args): raise exc.CommandError('Invalid adopt-file, no data!') if args.create_timeout: - logger.warning(_LW('%(arg1)s is deprecated, ' - 'please use %(arg2)s instead'), + logger.warning('%(arg1)s is deprecated, ' + 'please use %(arg2)s instead', { 'arg1': '-c/--create-timeout', 'arg2': '-t/--timeout'}) @@ -308,16 +306,16 @@ def do_stack_delete(hc, args): _("Are you sure you want to delete this stack(s) [y/N]? ")) prompt_response = sys.stdin.readline().lower() if not prompt_response.startswith('y'): - logger.info(_LI( - 'User did not confirm stack delete so taking no action.')) + logger.info( + 'User did not confirm stack delete so taking no action.') return except KeyboardInterrupt: # ctrl-c - logger.info(_LI( - 'User did not confirm stack delete (ctrl-c) so taking no action.')) + logger.info( + 'User did not confirm stack delete (ctrl-c) so taking no action.') return except EOFError: # ctrl-d - logger.info(_LI( - 'User did not confirm stack delete (ctrl-d) so taking no action.')) + logger.info( + 'User did not confirm stack delete (ctrl-d) so taking no action.') return for sid in args.id: