From a846a796ba60e6a7de0436b4f67f61d0a2b21dc2 Mon Sep 17 00:00:00 2001 From: yuanpeng Date: Tue, 21 Mar 2017 21:46:39 +0800 Subject: [PATCH] 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: If1f4bd2f6be967368f52fb367c5a428d3eb58a9d Closes-Bug:#1674551 --- .../functional/api/v1/clients/bay_client.py | 19 ++++++++----------- .../api/v1/clients/cluster_client.py | 19 ++++++++----------- magnum/tests/functional/common/base.py | 14 ++++++-------- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/magnum/tests/functional/api/v1/clients/bay_client.py b/magnum/tests/functional/api/v1/clients/bay_client.py index 7ca7c7a..a9833f6 100644 --- a/magnum/tests/functional/api/v1/clients/bay_client.py +++ b/magnum/tests/functional/api/v1/clients/bay_client.py @@ -13,9 +13,6 @@ from oslo_log import log as logging from tempest.lib import exceptions -from magnum.i18n import _LE -from magnum.i18n import _LI -from magnum.i18n import _LW from magnum.tests.functional.api.v1.models import bay_model from magnum.tests.functional.common import client from magnum.tests.functional.common import utils @@ -123,9 +120,9 @@ class BayClient(client.MagnumClient): lambda: self.does_bay_exist(bay_id), 10, 1800) except Exception: # In error state. Clean up the bay id if desired - self.LOG.error(_LE('Bay %s entered an exception state.'), bay_id) + self.LOG.error('Bay %s entered an exception state.' % bay_id) if delete_on_error: - self.LOG.error(_LE('We will attempt to delete bays now.')) + self.LOG.error('We will attempt to delete bays now.') self.delete_bay(bay_id) self.wait_for_bay_to_delete(bay_id) raise @@ -139,35 +136,35 @@ class BayClient(client.MagnumClient): resp, model = self.get_bay(bay_id) if model.status in ['CREATED', 'CREATE_COMPLETE', 'ERROR', 'CREATE_FAILED']: - self.LOG.info(_LI('Bay %s succeeded.'), bay_id) + self.LOG.info('Bay %s succeeded.' % bay_id) return True else: return False except exceptions.NotFound: - self.LOG.warning(_LW('Bay %s is not found.'), bay_id) + self.LOG.warning('Bay %s is not found.' % bay_id) return False def does_bay_exist(self, bay_id): try: resp, model = self.get_bay(bay_id) if model.status in ['CREATED', 'CREATE_COMPLETE']: - self.LOG.info(_LI('Bay %s is created.'), bay_id) + self.LOG.info('Bay %s is created.' % bay_id) return True elif model.status in ['ERROR', 'CREATE_FAILED']: - self.LOG.error(_LE('Bay %s is in fail state.'), bay_id) + self.LOG.error('Bay %s is in fail state.' % bay_id) raise exceptions.ServerFault( "Got into an error condition: %s for %s" % (model.status, bay_id)) else: return False except exceptions.NotFound: - self.LOG.warning(_LW('Bay %s is not found.'), bay_id) + self.LOG.warning('Bay %s is not found.' % bay_id) return False def does_bay_not_exist(self, bay_id): try: self.get_bay(bay_id) except exceptions.NotFound: - self.LOG.warning(_LW('Bay %s is not found.'), bay_id) + self.LOG.warning('Bay %s is not found.' % bay_id) return True return False diff --git a/magnum/tests/functional/api/v1/clients/cluster_client.py b/magnum/tests/functional/api/v1/clients/cluster_client.py index 91609bd..0b673ec 100644 --- a/magnum/tests/functional/api/v1/clients/cluster_client.py +++ b/magnum/tests/functional/api/v1/clients/cluster_client.py @@ -13,9 +13,6 @@ from oslo_log import log as logging from tempest.lib import exceptions -from magnum.i18n import _LE -from magnum.i18n import _LI -from magnum.i18n import _LW from magnum.tests.functional.api.v1.models import cluster_id_model from magnum.tests.functional.api.v1.models import cluster_model from magnum.tests.functional.common import client @@ -124,10 +121,10 @@ class ClusterClient(client.MagnumClient): lambda: self.does_cluster_exist(cluster_id), 10, 1800) except Exception: # In error state. Clean up the cluster id if desired - self.LOG.error(_LE('Cluster %s entered an exception state.'), + self.LOG.error('Cluster %s entered an exception state.' % cluster_id) if delete_on_error: - self.LOG.error(_LE('We will attempt to delete clusters now.')) + self.LOG.error('We will attempt to delete clusters now.') self.delete_cluster(cluster_id) self.wait_for_cluster_to_delete(cluster_id) raise @@ -141,22 +138,22 @@ class ClusterClient(client.MagnumClient): resp, model = self.get_cluster(cluster_id) if model.status in ['CREATED', 'CREATE_COMPLETE', 'ERROR', 'CREATE_FAILED']: - self.LOG.info(_LI('Cluster %s succeeded.'), cluster_id) + self.LOG.info('Cluster %s succeeded.' % cluster_id) return True else: return False except exceptions.NotFound: - self.LOG.warning(_LW('Cluster %s is not found.'), cluster_id) + self.LOG.warning('Cluster %s is not found.' % cluster_id) return False def does_cluster_exist(self, cluster_id): try: resp, model = self.get_cluster(cluster_id) if model.status in ['CREATED', 'CREATE_COMPLETE']: - self.LOG.info(_LI('Cluster %s is created.'), cluster_id) + self.LOG.info('Cluster %s is created.' % cluster_id) return True elif model.status in ['ERROR', 'CREATE_FAILED']: - self.LOG.error(_LE('Cluster %s is in fail state.'), + self.LOG.error('Cluster %s is in fail state.' % cluster_id) raise exceptions.ServerFault( "Got into an error condition: %s for %s" % @@ -164,13 +161,13 @@ class ClusterClient(client.MagnumClient): else: return False except exceptions.NotFound: - self.LOG.warning(_LW('Cluster %s is not found.'), cluster_id) + self.LOG.warning('Cluster %s is not found.' % cluster_id) return False def does_cluster_not_exist(self, cluster_id): try: self.get_cluster(cluster_id) except exceptions.NotFound: - self.LOG.warning(_LW('Cluster %s is not found.'), cluster_id) + self.LOG.warning('Cluster %s is not found.' % cluster_id) return True return False diff --git a/magnum/tests/functional/common/base.py b/magnum/tests/functional/common/base.py index b9f3dab..9ff2a36 100644 --- a/magnum/tests/functional/common/base.py +++ b/magnum/tests/functional/common/base.py @@ -17,8 +17,6 @@ import subprocess from tempest.lib import base import magnum -from magnum.i18n import _LE -from magnum.i18n import _LI COPY_LOG_HELPER = "magnum/tests/contrib/copy_instance_logs.sh" @@ -46,10 +44,10 @@ class BaseMagnumTest(base.BaseTestCase): """ def int_copy_logs(exec_info): try: - cls.LOG.info(_LI("Copying logs...")) + cls.LOG.info("Copying logs...") fn = exec_info[2].tb_frame.f_locals['fn'] func_name = fn.im_self._get_test_method().__name__ - msg = (_LE("Failed to copy logs for cluster")) + msg = ("Failed to copy logs for cluster") nodes_addresses = get_nodes_fn() master_nodes = nodes_addresses[0] @@ -63,7 +61,7 @@ class BaseMagnumTest(base.BaseTestCase): if not nodes_address: return - msg = _LI("copy logs from : %s") % ','.join(nodes_address) + msg = "copy logs from : %s" % ','.join(nodes_address) cls.LOG.info(msg) log_name = prefix + "-" + func_name for node_address in nodes_address: @@ -80,9 +78,9 @@ class BaseMagnumTest(base.BaseTestCase): except Exception: cls.LOG.error(msg) msg = ( - _LE("failed to copy from %(node_address)s " - "to %(base_path)s%(log_name)s-" - "%(node_address)s") % + "failed to copy from %(node_address)s " + "to %(base_path)s%(log_name)s-" + "%(node_address)s" % {'node_address': node_address, 'base_path': "/opt/stack/logs/cluster-nodes/", 'log_name': log_name})