From cbf2970a57edbec69600a8f098a2d464615a6754 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Tue, 11 Nov 2014 05:19:19 -0800 Subject: [PATCH] Update i18n translation for neutron.common/debug log msg's Validate that hacking rules apply to directories: - neutron/common - neutron/hacking - neutron/debug - neutron/locale Change-Id: I177f5fa5fb7cfdcf332949933aa4bd755a90bb94 Partial-bug: #1320867 --- neutron/common/config.py | 5 +++-- neutron/common/utils.py | 14 +++++++------- neutron/debug/debug_agent.py | 5 +++-- neutron/hacking/checks.py | 6 +++++- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/neutron/common/config.py b/neutron/common/config.py index 0aaebe29e..e16f15a58 100644 --- a/neutron/common/config.py +++ b/neutron/common/config.py @@ -26,6 +26,7 @@ from paste import deploy from neutron.api.v2 import attributes from neutron.common import utils +from neutron.openstack.common.gettextutils import _LI from neutron.openstack.common import log as logging from neutron import version @@ -161,7 +162,7 @@ def setup_logging(): """Sets up the logging options for a log with supplied name.""" product_name = "neutron" logging.setup(product_name) - LOG.info(_("Logging enabled!")) + LOG.info(_LI("Logging enabled!")) def load_paste_app(app_name): @@ -177,7 +178,7 @@ def load_paste_app(app_name): raise cfg.ConfigFilesNotFoundError( config_files=[cfg.CONF.api_paste_config]) config_path = os.path.abspath(config_path) - LOG.info(_("Config paste file: %s"), config_path) + LOG.info(_LI("Config paste file: %s"), config_path) try: app = deploy.loadapp("config:%s" % config_path, name=app_name) diff --git a/neutron/common/utils.py b/neutron/common/utils.py index 8fde56629..5bb893faa 100644 --- a/neutron/common/utils.py +++ b/neutron/common/utils.py @@ -66,9 +66,9 @@ class cache_method_results(object): try: item = target_self._cache.get(key, self._not_cached) except TypeError: - LOG.debug(_("Method %(func_name)s cannot be cached due to " - "unhashable parameters: args: %(args)s, kwargs: " - "%(kwargs)s"), + LOG.debug("Method %(func_name)s cannot be cached due to " + "unhashable parameters: args: %(args)s, kwargs: " + "%(kwargs)s", {'func_name': func_name, 'args': args, 'kwargs': kwargs}) @@ -89,9 +89,9 @@ class cache_method_results(object): 'class': target_self.__class__.__name__}) if not target_self._cache: if self._first_call: - LOG.debug(_("Instance of class %(module)s.%(class)s doesn't " - "contain attribute _cache therefore results " - "cannot be cached for %(func_name)s."), + LOG.debug("Instance of class %(module)s.%(class)s doesn't " + "contain attribute _cache therefore results " + "cannot be cached for %(func_name)s.", {'module': target_self.__module__, 'class': target_self.__class__.__name__, 'func_name': self.func.__name__}) @@ -115,7 +115,7 @@ def read_cached_file(filename, cache_info, reload_func=None): """ mtime = os.path.getmtime(filename) if not cache_info or mtime != cache_info.get('mtime'): - LOG.debug(_("Reloading cached file %s"), filename) + LOG.debug("Reloading cached file %s", filename) with open(filename) as fap: cache_info['data'] = fap.read() cache_info['mtime'] = mtime diff --git a/neutron/debug/debug_agent.py b/neutron/debug/debug_agent.py index c5d2d06ac..175c0d40a 100644 --- a/neutron/debug/debug_agent.py +++ b/neutron/debug/debug_agent.py @@ -23,6 +23,7 @@ from neutron.agent.common import config from neutron.agent.linux import dhcp from neutron.agent.linux import ip_lib from neutron.agent.linux import utils +from neutron.openstack.common.gettextutils import _LW from neutron.openstack.common import log as logging @@ -64,7 +65,7 @@ class NeutronDebugAgent(): namespace = self._get_namespace(port) if ip_lib.device_exists(interface_name, self.root_helper, namespace): - LOG.debug(_('Reusing existing device: %s.'), interface_name) + LOG.debug('Reusing existing device: %s.', interface_name) else: self.driver.plug(network.id, port.id, @@ -119,7 +120,7 @@ class NeutronDebugAgent(): try: ip.netns.delete(namespace) except Exception: - LOG.warn(_('Failed to delete namespace %s'), namespace) + LOG.warn(_LW('Failed to delete namespace %s'), namespace) else: self.driver.unplug(self.driver.get_device_name(port), bridge=bridge) diff --git a/neutron/hacking/checks.py b/neutron/hacking/checks.py index 0dac39478..18bf3b289 100644 --- a/neutron/hacking/checks.py +++ b/neutron/hacking/checks.py @@ -47,8 +47,12 @@ def _directory_to_check_translation(filename): dirs = ["neutron/agent", "neutron/api", "neutron/cmd", + "neutron/common", "neutron/db", - "neutron/extensions"] + "neutron/debug", + "neutron/extensions", + "neutron/hacking", + "neutron/locale"] return any([dir in filename for dir in dirs]) -- 2.45.2