diff --git a/moganclient/common/http.py b/moganclient/common/http.py index b518af2..b0870e3 100644 --- a/moganclient/common/http.py +++ b/moganclient/common/http.py @@ -29,7 +29,6 @@ from six.moves.urllib import parse from moganclient.common import exceptions as exc from moganclient.common.i18n import _ -from moganclient.common.i18n import _LW from moganclient.common import utils LOG = logging.getLogger(__name__) @@ -55,7 +54,7 @@ def get_system_ca_file(): if os.path.exists(ca): LOG.debug("Using ca file %s", ca) return ca - LOG.warning(_LW("System ca file could not be found.")) + LOG.warning("System ca file could not be found.") class HTTPClient(object): diff --git a/moganclient/common/i18n.py b/moganclient/common/i18n.py index b755a35..fc0d100 100644 --- a/moganclient/common/i18n.py +++ b/moganclient/common/i18n.py @@ -15,17 +15,5 @@ import oslo_i18n -_translators = oslo_i18n.TranslatorFactory(domain='moganclient') - # 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 +_ = oslo_i18n.TranslatorFactory(domain='moganclient').primary diff --git a/moganclient/common/utils.py b/moganclient/common/utils.py index 9e26075..012cb3c 100644 --- a/moganclient/common/utils.py +++ b/moganclient/common/utils.py @@ -15,7 +15,6 @@ import logging -from moganclient.common.i18n import _LE LOG = logging.getLogger(__name__) @@ -27,12 +26,12 @@ def get_response_body(resp): 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') elif 'application/octet-stream' in content_type: try: body = resp.body() except ValueError: - LOG.error(_LE('Could not decode response body as raw')) + LOG.error('Could not decode response body as raw') else: body = None return body diff --git a/moganclient/osc/v1/flavor.py b/moganclient/osc/v1/flavor.py index fb5f654..daf2e98 100644 --- a/moganclient/osc/v1/flavor.py +++ b/moganclient/osc/v1/flavor.py @@ -122,8 +122,8 @@ class DeleteFlavor(command.Command): bc_client.flavor.delete(data.uuid) except Exception as e: result += 1 - LOG.error(_("Failed to delete flavor with name or UUID " - "'%(flavor)s': %(e)s") % + LOG.error("Failed to delete flavor with name or UUID " + "'%(flavor)s': %(e)s", {'flavor': one_flavor, 'e': e}) if result > 0: @@ -200,7 +200,7 @@ class SetFlavor(command.Command): bc_client.flavor.add_tenant_access( data, parsed_args.project) except Exception as e: - LOG.error(_("Failed to set flavor access to project: %s"), e) + LOG.error("Failed to set flavor access to project: %s", e) result += 1 if result > 0: @@ -268,8 +268,7 @@ class UnsetFlavor(command.Command): bc_client.flavor.remove_tenant_access( data, parsed_args.project) except Exception as e: - LOG.error(_("Failed to remove flavor access to project: " - "%s"), e) + LOG.error("Failed to remove flavor access to project: %s", e) result += 1 if result > 0: diff --git a/moganclient/osc/v1/keypair.py b/moganclient/osc/v1/keypair.py index 7bb7abe..9d269a5 100644 --- a/moganclient/osc/v1/keypair.py +++ b/moganclient/osc/v1/keypair.py @@ -109,8 +109,8 @@ class DeleteKeyPair(command.Command): bc_client.keypair.delete(one_key, parsed_args.user) except Exception as e: result += 1 - LOG.error(_("Failed to delete keypair with name " - "'%(key)s': %(e)s") % + LOG.error("Failed to delete keypair with name " + "'%(key)s': %(e)s", {'key': one_key, 'e': e}) if result > 0: diff --git a/moganclient/osc/v1/server.py b/moganclient/osc/v1/server.py index f3f7bbb..42e8455 100644 --- a/moganclient/osc/v1/server.py +++ b/moganclient/osc/v1/server.py @@ -54,8 +54,8 @@ class ServersActionBase(command.Command): method(data.uuid, **kwargs) except Exception as e: result += 1 - LOG.error(_("Failed to %(action)s server with name or UUID " - "'%(server)s': %(e)s") % + LOG.error("Failed to %(action)s server with name or UUID " + "'%(server)s': %(e)s", {'action': action, 'server': one_server, 'e': e}) if result > 0: @@ -253,8 +253,8 @@ class DeleteServer(command.Command): bc_client.server.delete(data.uuid) except Exception as e: result += 1 - LOG.error(_("Failed to delete server with name or UUID " - "'%(server)s': %(e)s") % + LOG.error("Failed to delete server with name or UUID " + "'%(server)s': %(e)s", {'server': one_server, 'e': e}) if result > 0: