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
This commit is contained in:
Gary Kotton 2014-11-11 05:19:19 -08:00
parent 47f754c2f9
commit ae4df3dab6
4 changed files with 18 additions and 12 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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])