]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Update i18n translation for neutron.common/debug log msg's
authorGary Kotton <gkotton@vmware.com>
Tue, 11 Nov 2014 13:19:19 +0000 (05:19 -0800)
committerGary Kotton <gkotton@vmware.com>
Thu, 20 Nov 2014 06:37:16 +0000 (22:37 -0800)
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
neutron/common/utils.py
neutron/debug/debug_agent.py
neutron/hacking/checks.py

index 0aaebe29e8ec9a8225f81d0e72fac5d58c7aa872..e16f15a58e9ee7c3de3541dfba6d99f119b7e83a 100644 (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)
index 8fde566294a9cbb32fe469370964abdd03c9240e..5bb893faaf649c6376a3a573d93e321dd8b5e002 100644 (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
index c5d2d06ac4e057cfcbeb371571ee879a64dd0d81..175c0d40a1b27e731dd340673ad6e30376e10870 100644 (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)
index 0dac394786f1cb28b80b3a2ebc241c5be7efd610..18bf3b28954cd1645689e425e51cb9d6c98c6e2a 100644 (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])