Remove log translations
Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: I0a2263090899a86ff922f00feb92d440f9226c4b Closes-Bug: #1674374
This commit is contained in:
@@ -20,7 +20,6 @@ import os
|
||||
import appdirs
|
||||
import dogpile.cache
|
||||
|
||||
from ironicclient.common.i18n import _LW
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@@ -48,9 +47,9 @@ def _get_cache():
|
||||
try:
|
||||
expiry_time = int(expiry_time)
|
||||
except ValueError:
|
||||
LOG.warning(_LW("Environment variable %(env_var)s should be an "
|
||||
"integer (not '%(curr_val)s'). Using default "
|
||||
"expiry of %(default)s seconds instead."),
|
||||
LOG.warning("Environment variable %(env_var)s should be an "
|
||||
"integer (not '%(curr_val)s'). Using default "
|
||||
"expiry of %(default)s seconds instead.",
|
||||
{'env_var': CACHE_EXPIRY_ENV_VAR,
|
||||
'curr_val': expiry_time,
|
||||
'default': DEFAULT_EXPIRY})
|
||||
|
@@ -35,8 +35,6 @@ import six.moves.urllib.parse as urlparse
|
||||
|
||||
from ironicclient.common import filecache
|
||||
from ironicclient.common.i18n import _
|
||||
from ironicclient.common.i18n import _LE
|
||||
from ironicclient.common.i18n import _LW
|
||||
from ironicclient import exc
|
||||
|
||||
|
||||
@@ -189,8 +187,8 @@ def with_retries(func):
|
||||
try:
|
||||
return func(self, url, method, **kwargs)
|
||||
except _RETRY_EXCEPTIONS as error:
|
||||
msg = (_LE("Error contacting Ironic server: %(error)s. "
|
||||
"Attempt %(attempt)d of %(total)d") %
|
||||
msg = ("Error contacting Ironic server: %(error)s. "
|
||||
"Attempt %(attempt)d of %(total)d" %
|
||||
{'attempt': attempt,
|
||||
'total': num_attempts,
|
||||
'error': error})
|
||||
@@ -404,7 +402,7 @@ class HTTPClient(VersionNegotiationMixin):
|
||||
try:
|
||||
body = jsonutils.loads(body)
|
||||
except ValueError:
|
||||
LOG.error(_LE('Could not decode response body as JSON'))
|
||||
LOG.error('Could not decode response body as JSON')
|
||||
else:
|
||||
body = None
|
||||
|
||||
@@ -568,7 +566,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
|
||||
try:
|
||||
body = resp.json()
|
||||
except ValueError:
|
||||
LOG.error(_LE('Could not decode response body as JSON'))
|
||||
LOG.error('Could not decode response body as JSON')
|
||||
else:
|
||||
body = None
|
||||
|
||||
@@ -612,8 +610,8 @@ def _construct_http_client(endpoint=None,
|
||||
dvars = [k for k, v in ignored.items() if v]
|
||||
|
||||
if dvars:
|
||||
LOG.warning(_LW('The following arguments are ignored when using '
|
||||
'the session to construct a client: %s'),
|
||||
LOG.warning('The following arguments are ignored when using '
|
||||
'the session to construct a client: %s',
|
||||
', '.join(dvars))
|
||||
|
||||
return SessionClient(session=session,
|
||||
@@ -625,8 +623,8 @@ def _construct_http_client(endpoint=None,
|
||||
**kwargs)
|
||||
else:
|
||||
if kwargs:
|
||||
LOG.warning(_LW('The following arguments are being ignored when '
|
||||
'constructing the client: %s'), ', '.join(kwargs))
|
||||
LOG.warning('The following arguments are being ignored when '
|
||||
'constructing the client: %s'), ', '.join(kwargs)
|
||||
|
||||
return HTTPClient(endpoint=endpoint,
|
||||
token=token,
|
||||
|
@@ -19,13 +19,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='ironicclient')
|
||||
|
||||
# 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
|
||||
|
@@ -20,7 +20,7 @@ import logging
|
||||
from osc_lib.command import command
|
||||
from osc_lib import utils as oscutils
|
||||
|
||||
from ironicclient.common.i18n import _, _LW
|
||||
from ironicclient.common.i18n import _
|
||||
from ironicclient.common import utils
|
||||
from ironicclient import exc
|
||||
from ironicclient.v1 import resource_fields as res_fields
|
||||
@@ -237,7 +237,7 @@ class SetBaremetalChassis(command.Command):
|
||||
if properties:
|
||||
baremetal_client.chassis.update(parsed_args.chassis, properties)
|
||||
else:
|
||||
self.log.warning(_LW("Please specify what to set."))
|
||||
self.log.warning("Please specify what to set.")
|
||||
|
||||
|
||||
class ShowBaremetalChassis(command.ShowOne):
|
||||
@@ -322,4 +322,4 @@ class UnsetBaremetalChassis(command.Command):
|
||||
if properties:
|
||||
baremetal_client.chassis.update(parsed_args.chassis, properties)
|
||||
else:
|
||||
self.log.warning(_LW("Please specify what to unset."))
|
||||
self.log.warning("Please specify what to unset.")
|
||||
|
@@ -13,7 +13,7 @@
|
||||
import argparse
|
||||
import logging
|
||||
|
||||
from ironicclient.common.i18n import _, _LW
|
||||
from ironicclient.common.i18n import _
|
||||
from ironicclient import exc
|
||||
from ironicclient.osc.v1 import baremetal_node
|
||||
from ironicclient.v1 import create_resources
|
||||
@@ -61,8 +61,8 @@ class CreateBaremetal(baremetal_node.CreateBaremetalNode):
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
if parsed_args.driver:
|
||||
self.log.warning(_LW("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node create'."))
|
||||
self.log.warning("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node create'.")
|
||||
return super(CreateBaremetal, self).take_action(parsed_args)
|
||||
if not parsed_args.resource_files:
|
||||
raise exc.ValidationError(_(
|
||||
|
@@ -21,7 +21,7 @@ import logging
|
||||
from osc_lib.command import command
|
||||
from osc_lib import utils as oscutils
|
||||
|
||||
from ironicclient.common.i18n import _, _LW
|
||||
from ironicclient.common.i18n import _
|
||||
from ironicclient.common import utils
|
||||
from ironicclient import exc
|
||||
from ironicclient.v1 import resource_fields as res_fields
|
||||
@@ -471,8 +471,8 @@ class DeleteBaremetal(DeleteBaremetalNode):
|
||||
log = logging.getLogger(__name__ + ".DeleteBaremetal")
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.warning(_LW("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node delete'."))
|
||||
self.log.warning("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node delete'.")
|
||||
super(DeleteBaremetal, self).take_action(parsed_args)
|
||||
|
||||
|
||||
@@ -652,8 +652,8 @@ class ListBaremetal(ListBaremetalNode):
|
||||
log = logging.getLogger(__name__ + ".ListBaremetal")
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.warning(_LW("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node list'."))
|
||||
self.log.warning("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node list'.")
|
||||
return super(ListBaremetal, self).take_action(parsed_args)
|
||||
|
||||
|
||||
@@ -1053,7 +1053,7 @@ class SetBaremetalNode(command.Command):
|
||||
if properties:
|
||||
baremetal_client.node.update(parsed_args.node, properties)
|
||||
else:
|
||||
self.log.warning(_LW("Please specify what to set."))
|
||||
self.log.warning("Please specify what to set.")
|
||||
|
||||
|
||||
class SetBaremetal(SetBaremetalNode):
|
||||
@@ -1063,8 +1063,8 @@ class SetBaremetal(SetBaremetalNode):
|
||||
log = logging.getLogger(__name__ + ".SetBaremetal")
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.warning(_LW("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node set'."))
|
||||
self.log.warning("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node set'.")
|
||||
return super(SetBaremetal, self).take_action(parsed_args)
|
||||
|
||||
|
||||
@@ -1128,8 +1128,8 @@ class ShowBaremetal(ShowBaremetalNode):
|
||||
log = logging.getLogger(__name__ + ".ShowBaremetal")
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.warning(_LW("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node show'."))
|
||||
self.log.warning("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node show'.")
|
||||
return super(ShowBaremetal, self).take_action(parsed_args)
|
||||
|
||||
|
||||
@@ -1253,7 +1253,7 @@ class UnsetBaremetalNode(command.Command):
|
||||
if properties:
|
||||
baremetal_client.node.update(parsed_args.node, properties)
|
||||
else:
|
||||
self.log.warning(_LW("Please specify what to unset."))
|
||||
self.log.warning("Please specify what to unset.")
|
||||
|
||||
|
||||
class UnsetBaremetal(UnsetBaremetalNode):
|
||||
@@ -1263,8 +1263,8 @@ class UnsetBaremetal(UnsetBaremetalNode):
|
||||
log = logging.getLogger(__name__ + ".UnsetBaremetal")
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.warning(_LW("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node unset'."))
|
||||
self.log.warning("This command is deprecated. Instead, use "
|
||||
"'openstack baremetal node unset'.")
|
||||
super(UnsetBaremetal, self).take_action(parsed_args)
|
||||
|
||||
|
||||
|
@@ -20,7 +20,7 @@ import logging
|
||||
from osc_lib.command import command
|
||||
from osc_lib import utils as oscutils
|
||||
|
||||
from ironicclient.common.i18n import _, _LW
|
||||
from ironicclient.common.i18n import _
|
||||
from ironicclient.common import utils
|
||||
from ironicclient import exc
|
||||
from ironicclient.v1 import resource_fields as res_fields
|
||||
@@ -93,9 +93,9 @@ class CreateBaremetalPort(command.ShowOne):
|
||||
baremetal_client = self.app.client_manager.baremetal
|
||||
|
||||
if parsed_args.local_link_connection_deprecated:
|
||||
self.log.warning(_LW("Please use --local-link-connection instead "
|
||||
"of -l, as it is deprecated and will be "
|
||||
"removed in future releases."))
|
||||
self.log.warning("Please use --local-link-connection instead "
|
||||
"of -l, as it is deprecated and will be "
|
||||
"removed in future releases.")
|
||||
# It is parsed to either None, or to an array
|
||||
if parsed_args.local_link_connection:
|
||||
parsed_args.local_link_connection.extend(
|
||||
@@ -214,7 +214,7 @@ class UnsetBaremetalPort(command.Command):
|
||||
if properties:
|
||||
baremetal_client.port.update(parsed_args.port, properties)
|
||||
else:
|
||||
self.log.warning(_LW("Please specify what to unset."))
|
||||
self.log.warning("Please specify what to unset.")
|
||||
|
||||
|
||||
class SetBaremetalPort(command.Command):
|
||||
@@ -281,7 +281,7 @@ class SetBaremetalPort(command.Command):
|
||||
if properties:
|
||||
baremetal_client.port.update(parsed_args.port, properties)
|
||||
else:
|
||||
self.log.warning(_LW("Please specify what to set."))
|
||||
self.log.warning("Please specify what to set.")
|
||||
|
||||
|
||||
class DeleteBaremetalPort(command.Command):
|
||||
|
@@ -20,7 +20,7 @@ import logging
|
||||
from osc_lib.command import command
|
||||
from osc_lib import utils as oscutils
|
||||
|
||||
from ironicclient.common.i18n import _, _LW
|
||||
from ironicclient.common.i18n import _
|
||||
from ironicclient.common import utils
|
||||
from ironicclient import exc
|
||||
from ironicclient.v1 import resource_fields as res_fields
|
||||
@@ -392,7 +392,7 @@ class SetBaremetalPortGroup(command.Command):
|
||||
baremetal_client.portgroup.update(parsed_args.portgroup,
|
||||
properties)
|
||||
else:
|
||||
self.log.warning(_LW("Please specify what to set."))
|
||||
self.log.warning("Please specify what to set.")
|
||||
|
||||
|
||||
class UnsetBaremetalPortGroup(command.Command):
|
||||
@@ -458,4 +458,4 @@ class UnsetBaremetalPortGroup(command.Command):
|
||||
baremetal_client.portgroup.update(parsed_args.portgroup,
|
||||
properties)
|
||||
else:
|
||||
self.log.warning(_LW("Please specify what to unset."))
|
||||
self.log.warning("Please specify what to unset.")
|
||||
|
Reference in New Issue
Block a user