From 4e0d1e03d21e1c51f70a0a9d01be73a32945e22c Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Mon, 20 Jun 2016 05:23:34 -0700 Subject: [PATCH] Add in missing log translation hints The patch does the following: 1. Adds in missing translations dfor log messages 2. The updated messages have dictionaries TrivialFix Change-Id: Id03a600694e561c4647094887fd55de127678cd1 --- heat/common/context.py | 6 +++--- heat/engine/check_resource.py | 6 ++++-- .../resources/openstack/heat/test_resource.py | 14 +++++++++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/heat/common/context.py b/heat/common/context.py index 9fcf2ea723..82c0d1cf44 100644 --- a/heat/common/context.py +++ b/heat/common/context.py @@ -173,9 +173,9 @@ class RequestContext(context.RequestContext): if auth_uri: return auth_uri else: - LOG.error('Keystone API endpoint not provided. Set ' - 'auth_uri in section [clients_keystone] ' - 'of the configuration file.') + LOG.error(_LE('Keystone API endpoint not provided. Set ' + 'auth_uri in section [clients_keystone] ' + 'of the configuration file.')) raise exception.AuthorizationFailure() @property diff --git a/heat/engine/check_resource.py b/heat/engine/check_resource.py index 2e7a7e8a7f..0c6842ed1c 100644 --- a/heat/engine/check_resource.py +++ b/heat/engine/check_resource.py @@ -94,7 +94,8 @@ class CheckResource(object): stack) except exception.UpdateReplace: new_res_id = rsrc.make_replacement(tmpl.id) - LOG.info("Replacing resource with new id %s", new_res_id) + LOG.info(_LI("Replacing resource with new id %s"), + new_res_id) rpc_data = sync_point.serialize_input_data(resource_data) self._rpc_client.check_resource(cnxt, new_res_id, @@ -147,7 +148,8 @@ class CheckResource(object): # if No, then latest traversal is waiting for delete. if (resource_id, is_update) not in graph: key = (resource_id, not is_update) - LOG.info('Re-trigger resource: (%s, %s)' % (key[0], key[1])) + LOG.info(_LI('Re-trigger resource: (%(key1)s, %(key2)s)'), + {'key1': key[0], 'key2': key[1]}) predecessors = set(graph[key]) try: diff --git a/heat/engine/resources/openstack/heat/test_resource.py b/heat/engine/resources/openstack/heat/test_resource.py index 87af2ac228..17a40794af 100644 --- a/heat/engine/resources/openstack/heat/test_resource.py +++ b/heat/engine/resources/openstack/heat/test_resource.py @@ -16,7 +16,7 @@ import eventlet from oslo_utils import timeutils import six -from heat.common.i18n import _ +from heat.common.i18n import _, _LI from heat.engine import attributes from heat.engine import constraints from heat.engine import properties @@ -161,8 +161,10 @@ class TestResource(resource.Resource): secs = self.properties[self.ACTION_WAIT_SECS][self.action.lower()] if secs is None: secs = self.properties[self.WAIT_SECS] - LOG.info('%s wait_secs:%s, action:%s' % (self.name, secs, - self.action.lower())) + LOG.info(_LI('%(name)s wait_secs:%(wait)s, action:%(action)s'), + {'name': self.name, + 'wait': secs, + 'action': self.action.lower()}) return secs def handle_create(self): @@ -226,8 +228,10 @@ class TestResource(resource.Resource): started_at = timeutils.normalize_time(started_at) waited = timeutils.utcnow() - started_at - LOG.info("Resource %s waited %s/%s seconds", - self.name, waited, wait_secs) + LOG.info(_LI("Resource %(name)s waited %(waited)s/%(sec)s seconds"), + {'name': self.name, + 'waited': waited, + 'sec': wait_secs}) # wait_secs < 0 is an infinite wait time. if wait_secs >= 0 and waited > datetime.timedelta(seconds=wait_secs):