]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Update i18n translation for neutron.notifiers log msg's
authorGary Kotton <gkotton@vmware.com>
Tue, 11 Nov 2014 13:28:21 +0000 (05:28 -0800)
committerGary Kotton <gkotton@vmware.com>
Thu, 20 Nov 2014 07:24:40 +0000 (23:24 -0800)
Validate that hacking rules apply to directories:
 - neutron/notifiers
 - neutron/openstack (this is already 'clean')

Change-Id: I37b8c45e20d2f59e4e9f5d80d5dc87f19a7a8b3a
Partial-bug: #1320867

neutron/hacking/checks.py
neutron/notifiers/nova.py

index 18bf3b28954cd1645689e425e51cb9d6c98c6e2a..6aefc8ca6d9ce3bdcee219aadd35fbe3ea308674 100644 (file)
@@ -52,7 +52,9 @@ def _directory_to_check_translation(filename):
             "neutron/debug",
             "neutron/extensions",
             "neutron/hacking",
-            "neutron/locale"]
+            "neutron/locale",
+            "neutron/notifiers",
+            "neutron/openstack"]
     return any([dir in filename for dir in dirs])
 
 
index e95100597aa9b56cb4f51af9404bdb7fcd2cc338..a778a2a5eb494d8d6dff5f65f6a4cc8615939959 100644 (file)
@@ -23,6 +23,7 @@ from sqlalchemy.orm import attributes as sql_attr
 from neutron.common import constants
 from neutron import context
 from neutron import manager
+from neutron.openstack.common.gettextutils import _LE, _LI, _LW
 from neutron.openstack.common import log as logging
 from neutron.openstack.common import uuidutils
 
@@ -178,12 +179,12 @@ class Notifier(object):
         port._notify_event = None
         # If there is no device_id set there is nothing we can do here.
         if not port.device_id:
-            LOG.debug(_("device_id is not set on port yet."))
+            LOG.debug("device_id is not set on port yet.")
             return
 
         if not port.id:
-            LOG.warning(_("Port ID not set! Nova will not be notified of "
-                          "port status change."))
+            LOG.warning(_LW("Port ID not set! Nova will not be notified of "
+                            "port status change."))
             return
 
         # We only want to notify about nova ports.
@@ -207,9 +208,9 @@ class Notifier(object):
             event_name = VIF_PLUGGED
         # All the remaining state transitions are of no interest to nova
         else:
-            LOG.debug(_("Ignoring state change previous_port_status: "
-                        "%(pre_status)s current_port_status: %(cur_status)s"
-                        " port_id %(id)s") %
+            LOG.debug("Ignoring state change previous_port_status: "
+                      "%(pre_status)s current_port_status: %(cur_status)s"
+                      " port_id %(id)s",
                       {'pre_status': previous_port_status,
                        'cur_status': current_port_status,
                        'id': port.id})
@@ -233,19 +234,19 @@ class Notifier(object):
         batched_events = self.pending_events
         self.pending_events = []
 
-        LOG.debug(_("Sending events: %s"), batched_events)
+        LOG.debug("Sending events: %s", batched_events)
         try:
             response = self.nclient.server_external_events.create(
                 batched_events)
         except nova_exceptions.NotFound:
-            LOG.warning(_("Nova returned NotFound for event: %s"),
+            LOG.warning(_LW("Nova returned NotFound for event: %s"),
                         batched_events)
         except Exception:
-            LOG.exception(_("Failed to notify nova on events: %s"),
+            LOG.exception(_LE("Failed to notify nova on events: %s"),
                           batched_events)
         else:
             if not isinstance(response, list):
-                LOG.error(_("Error response returned from nova: %s"),
+                LOG.error(_LE("Error response returned from nova: %s"),
                           response)
                 return
             response_error = False
@@ -256,10 +257,10 @@ class Notifier(object):
                     response_error = True
                     continue
                 if code != 200:
-                    LOG.warning(_("Nova event: %s returned with failed "
-                                  "status"), event)
+                    LOG.warning(_LW("Nova event: %s returned with failed "
+                                    "status"), event)
                 else:
-                    LOG.info(_("Nova event response: %s"), event)
+                    LOG.info(_LI("Nova event response: %s"), event)
             if response_error:
-                LOG.error(_("Error response returned from nova: %s"),
+                LOG.error(_LE("Error response returned from nova: %s"),
                           response)