Update i18n translation for neutron.notifiers log msg's

Validate that hacking rules apply to directories:
 - neutron/notifiers
 - neutron/openstack (this is already 'clean')

Change-Id: I37b8c45e20d2f59e4e9f5d80d5dc87f19a7a8b3a
Partial-bug: #1320867
This commit is contained in:
Gary Kotton 2014-11-11 05:28:21 -08:00
parent cbf2970a57
commit 09566e272f
2 changed files with 18 additions and 15 deletions

View File

@ -52,7 +52,9 @@ def _directory_to_check_translation(filename):
"neutron/debug", "neutron/debug",
"neutron/extensions", "neutron/extensions",
"neutron/hacking", "neutron/hacking",
"neutron/locale"] "neutron/locale",
"neutron/notifiers",
"neutron/openstack"]
return any([dir in filename for dir in dirs]) return any([dir in filename for dir in dirs])

View File

@ -23,6 +23,7 @@ from sqlalchemy.orm import attributes as sql_attr
from neutron.common import constants from neutron.common import constants
from neutron import context from neutron import context
from neutron import manager 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 log as logging
from neutron.openstack.common import uuidutils from neutron.openstack.common import uuidutils
@ -178,11 +179,11 @@ class Notifier(object):
port._notify_event = None port._notify_event = None
# If there is no device_id set there is nothing we can do here. # If there is no device_id set there is nothing we can do here.
if not port.device_id: 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 return
if not port.id: if not port.id:
LOG.warning(_("Port ID not set! Nova will not be notified of " LOG.warning(_LW("Port ID not set! Nova will not be notified of "
"port status change.")) "port status change."))
return return
@ -207,9 +208,9 @@ class Notifier(object):
event_name = VIF_PLUGGED event_name = VIF_PLUGGED
# All the remaining state transitions are of no interest to nova # All the remaining state transitions are of no interest to nova
else: else:
LOG.debug(_("Ignoring state change previous_port_status: " LOG.debug("Ignoring state change previous_port_status: "
"%(pre_status)s current_port_status: %(cur_status)s" "%(pre_status)s current_port_status: %(cur_status)s"
" port_id %(id)s") % " port_id %(id)s",
{'pre_status': previous_port_status, {'pre_status': previous_port_status,
'cur_status': current_port_status, 'cur_status': current_port_status,
'id': port.id}) 'id': port.id})
@ -233,19 +234,19 @@ class Notifier(object):
batched_events = self.pending_events batched_events = self.pending_events
self.pending_events = [] self.pending_events = []
LOG.debug(_("Sending events: %s"), batched_events) LOG.debug("Sending events: %s", batched_events)
try: try:
response = self.nclient.server_external_events.create( response = self.nclient.server_external_events.create(
batched_events) batched_events)
except nova_exceptions.NotFound: except nova_exceptions.NotFound:
LOG.warning(_("Nova returned NotFound for event: %s"), LOG.warning(_LW("Nova returned NotFound for event: %s"),
batched_events) batched_events)
except Exception: except Exception:
LOG.exception(_("Failed to notify nova on events: %s"), LOG.exception(_LE("Failed to notify nova on events: %s"),
batched_events) batched_events)
else: else:
if not isinstance(response, list): if not isinstance(response, list):
LOG.error(_("Error response returned from nova: %s"), LOG.error(_LE("Error response returned from nova: %s"),
response) response)
return return
response_error = False response_error = False
@ -256,10 +257,10 @@ class Notifier(object):
response_error = True response_error = True
continue continue
if code != 200: if code != 200:
LOG.warning(_("Nova event: %s returned with failed " LOG.warning(_LW("Nova event: %s returned with failed "
"status"), event) "status"), event)
else: else:
LOG.info(_("Nova event response: %s"), event) LOG.info(_LI("Nova event response: %s"), event)
if response_error: if response_error:
LOG.error(_("Error response returned from nova: %s"), LOG.error(_LE("Error response returned from nova: %s"),
response) response)