Remove translation of log messages

Remove translation of log messages. Log messages will no longer be
translated.

Closes-Bug: #1674374
Change-Id: I66791c08e335c5c5dd7b65a8df6e2132192630a2
This commit is contained in:
John L. Villalovos 2017-03-20 11:14:11 -07:00
parent 009d0abcad
commit 2547573407
6 changed files with 39 additions and 59 deletions

View File

@ -19,13 +19,3 @@ _translators = i18n.TranslatorFactory(domain='ironic-lib')
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical

View File

@ -21,7 +21,6 @@ from oslo_log import log as logging
from oslo_service import loopingcall
from ironic_lib.common.i18n import _
from ironic_lib.common.i18n import _LW
from ironic_lib import exception
from ironic_lib import utils
@ -132,8 +131,8 @@ class DiskPartitioner(object):
pids_match = re.search(self._fuser_pids_re, out)
pids[0] = pids_match.group()
except processutils.ProcessExecutionError as exc:
LOG.warning(_LW('Failed to check the device %(device)s with fuser:'
' %(err)s'), {'device': self._device, 'err': exc})
LOG.warning('Failed to check the device %(device)s with fuser:'
' %(err)s', {'device': self._device, 'err': exc})
def commit(self):
"""Write to the disk."""

View File

@ -34,9 +34,6 @@ import requests
import six
from ironic_lib.common.i18n import _
from ironic_lib.common.i18n import _LE
from ironic_lib.common.i18n import _LI
from ironic_lib.common.i18n import _LW
from ironic_lib import disk_partitioner
from ironic_lib import exception
from ironic_lib import utils
@ -97,9 +94,9 @@ def list_partitions(device):
for line in lines:
match = _PARTED_PRINT_RE.match(line)
if match is None:
LOG.warning(_LW("Partition information from parted for device "
"%(device)s does not match "
"expected format: %(line)s"),
LOG.warning("Partition information from parted for device "
"%(device)s does not match "
"expected format: %(line)s",
dict(device=device, line=line))
continue
# Cast int fields to ints (some are floats and we round them down)
@ -370,8 +367,8 @@ def destroy_disk_metadata(dev, node_uuid):
run_as_root=True,
use_standard_locale=True)
LOG.info(_LI("Disk metadata on %(dev)s successfully destroyed for node "
"%(node)s"), {'dev': dev, 'node': node_uuid})
LOG.info("Disk metadata on %(dev)s successfully destroyed for node "
"%(node)s", {'dev': dev, 'node': node_uuid})
def _get_configdrive(configdrive, node_uuid, tempdir=None):
@ -489,8 +486,8 @@ def work_on_disk(dev, root_mb, swap_mb, ephemeral_mb, ephemeral_format,
boot_option=boot_option,
boot_mode=boot_mode,
disk_label=disk_label)
LOG.info(_LI("Successfully completed the disk device"
" %(dev)s partitioning for node %(node)s"),
LOG.info("Successfully completed the disk device"
" %(dev)s partitioning for node %(node)s",
{'dev': dev, "node": node_uuid})
ephemeral_part = part_dict.get('ephemeral')
@ -522,8 +519,8 @@ def work_on_disk(dev, root_mb, swap_mb, ephemeral_mb, ephemeral_format,
if configdrive_part:
# Copy the configdrive content to the configdrive partition
dd(configdrive_file, configdrive_part)
LOG.info(_LI("Configdrive for node %(node)s successfully copied "
"onto partition %(partition)s"),
LOG.info("Configdrive for node %(node)s successfully copied "
"onto partition %(partition)s",
{'node': node_uuid, 'partition': configdrive_part})
finally:
@ -533,20 +530,20 @@ def work_on_disk(dev, root_mb, swap_mb, ephemeral_mb, ephemeral_format,
utils.unlink_without_raise(configdrive_file)
populate_image(image_path, root_part)
LOG.info(_LI("Image for %(node)s successfully populated"),
LOG.info("Image for %(node)s successfully populated",
{'node': node_uuid})
if swap_part:
utils.mkfs(fs='swap', path=swap_part, label='swap1')
LOG.info(_LI("Swap partition %(swap)s successfully formatted "
"for node %(node)s"),
LOG.info("Swap partition %(swap)s successfully formatted "
"for node %(node)s",
{'swap': swap_part, 'node': node_uuid})
if ephemeral_part and not preserve_ephemeral:
utils.mkfs(fs=ephemeral_format, path=ephemeral_part,
label="ephemeral0")
LOG.info(_LI("Ephemeral partition %(ephemeral)s successfully "
"formatted for node %(node)s"),
LOG.info("Ephemeral partition %(ephemeral)s successfully "
"formatted for node %(node)s",
{'ephemeral': ephemeral_part, 'node': node_uuid})
uuids_to_return = {
@ -561,7 +558,7 @@ def work_on_disk(dev, root_mb, swap_mb, ephemeral_mb, ephemeral_format,
except processutils.ProcessExecutionError:
with excutils.save_and_reraise_exception():
LOG.error(_LE("Failed to detect %s"), part)
LOG.error("Failed to detect %s", part)
return uuids_to_return
@ -767,9 +764,9 @@ def create_config_drive_partition(node_uuid, device, configdrive):
endlimit = '-0'
if _is_disk_larger_than_max_size(device, node_uuid):
# Need to create a small partition at 2TB limit
LOG.warning(_LW("Disk size is larger than 2TB for "
"node %(node)s. Creating config drive "
"at the end of the disk %(disk)s."),
LOG.warning("Disk size is larger than 2TB for "
"node %(node)s. Creating config drive "
"at the end of the disk %(disk)s.",
{'node': node_uuid, 'disk': device})
startlimit = (MAX_DISK_SIZE_MB_SUPPORTED_BY_MBR -
MAX_CONFIG_DRIVE_SIZE_MB - 1)
@ -801,8 +798,8 @@ def create_config_drive_partition(node_uuid, device, configdrive):
'--exit-if-exists=%s' % config_drive_part)
dd(confdrive_file, config_drive_part)
LOG.info(_LI("Configdrive for node %(node)s successfully "
"copied onto partition %(part)s"),
LOG.info("Configdrive for node %(node)s successfully "
"copied onto partition %(part)s",
{'node': node_uuid, 'part': config_drive_part})
except (processutils.UnknownArgumentError,

View File

@ -29,7 +29,6 @@ from oslo_utils import excutils
import six
from ironic_lib.common.i18n import _
from ironic_lib.common.i18n import _LE
LOG = logging.getLogger(__name__)
@ -76,8 +75,8 @@ class IronicException(Exception):
# kwargs doesn't match a variable in the message
# log the issue and the kwargs
prs = ', '.join('%s=%s' % pair for pair in kwargs.items())
LOG.exception(_LE('Exception in string format operation '
'(arguments %s)'), prs)
LOG.exception('Exception in string format operation '
'(arguments %s)', prs)
if not CONF.ironic_lib.fatal_exception_format_errors:
# at least get the core message out if something
# happened

View File

@ -19,7 +19,6 @@ import socket
from oslo_config import cfg
from oslo_log import log
from ironic_lib.common.i18n import _LW
from ironic_lib import metrics
statsd_opts = [
@ -83,9 +82,8 @@ class StatsdMetricLogger(metrics.MetricLogger):
sock.settimeout(0.0)
sock.sendto(metric, self._target)
except socket.error as e:
LOG.warning(_LW("Failed to send the metric value to "
"host %(host)s port %(port)s. "
"Error: %(error)s"),
LOG.warning("Failed to send the metric value to host "
"%(host)s, port %(port)s. Error: %(error)s",
{'host': self._host, 'port': self._port,
'error': e})

View File

@ -34,9 +34,6 @@ import six
from six.moves.urllib import parse
from ironic_lib.common.i18n import _
from ironic_lib.common.i18n import _LE
from ironic_lib.common.i18n import _LI
from ironic_lib.common.i18n import _LW
from ironic_lib import exception
utils_opts = [
@ -135,12 +132,12 @@ def mkfs(fs, path, label=None):
with excutils.save_and_reraise_exception() as ctx:
if os.strerror(errno.ENOENT) in e.stderr:
ctx.reraise = False
LOG.exception(_LE('Failed to make file system. '
'File system %s is not supported.'), fs)
LOG.exception('Failed to make file system. '
'File system %s is not supported.', fs)
raise exception.FileSystemNotSupported(fs=fs)
else:
LOG.exception(_LE('Failed to create a file system '
'in %(path)s. Error: %(error)s'),
LOG.exception('Failed to create a file system '
'in %(path)s. Error: %(error)s',
{'path': path, 'error': e})
@ -151,7 +148,7 @@ def unlink_without_raise(path):
if e.errno == errno.ENOENT:
return
else:
LOG.warning(_LW("Failed to unlink %(path)s, error: %(e)s"),
LOG.warning("Failed to unlink %(path)s, error: %(e)s",
{'path': path, 'e': e})
@ -375,8 +372,8 @@ def match_root_device_hints(devices, root_device_hints):
hint)
except ValueError:
LOG.warning(
_LW('The attribute "%(attr)s" of the device "%(dev)s" '
'has an empty value. Skipping device.'),
'The attribute "%(attr)s" of the device "%(dev)s" '
'has an empty value. Skipping device.',
{'attr': hint, 'dev': device_name})
break
@ -400,9 +397,9 @@ def match_root_device_hints(devices, root_device_hints):
device_value = strutils.bool_from_string(device_value,
strict=True)
except ValueError:
LOG.warning(_LW('The attribute "%(attr)s" (with value '
'"%(value)s") of device "%(dev)s" is not '
'a valid Boolean. Skipping device.'),
LOG.warning('The attribute "%(attr)s" (with value '
'"%(value)s") of device "%(dev)s" is not '
'a valid Boolean. Skipping device.',
{'attr': hint, 'value': device_value,
'dev': device_name})
break
@ -413,8 +410,8 @@ def match_root_device_hints(devices, root_device_hints):
if not specs_matcher.match(device_value, hint_value):
break
else:
LOG.info(_LI('Device found! The device "%s" matches the root '
'device hints'), device_name)
LOG.info('Device found! The device "%s" matches the root '
'device hints', device_name)
return dev
LOG.warning(_LW('No device found that matches the root device hints'))
LOG.warning('No device found that matches the root device hints')