diff --git a/heat/api/aws/ec2token.py b/heat/api/aws/ec2token.py index 6a28e7923..c3efa73c2 100644 --- a/heat/api/aws/ec2token.py +++ b/heat/api/aws/ec2token.py @@ -20,6 +20,8 @@ import webob from heat.api.aws import exception from heat.api.aws.exception import HeatAPIException from heat.common.i18n import _ +from heat.common.i18n import _LE +from heat.common.i18n import _LI from heat.common import wsgi from heat.openstack.common import importutils from heat.openstack.common import jsonutils as json @@ -136,14 +138,14 @@ class EC2Token(wsgi.Middleware): # here so that we can use both authentication methods. # Returning here just means the user didn't supply AWS # authentication and we'll let the app try native keystone next. - LOG.info(_("Checking AWS credentials..")) + LOG.info(_LI("Checking AWS credentials..")) signature = self._get_signature(req) if not signature: if 'X-Auth-User' in req.headers: return self.application else: - LOG.info(_("No AWS Signature found.")) + LOG.info(_LI("No AWS Signature found.")) raise exception.HeatIncompleteSignatureError() access = self._get_access(req) @@ -151,14 +153,14 @@ class EC2Token(wsgi.Middleware): if 'X-Auth-User' in req.headers: return self.application else: - LOG.info(_("No AWSAccessKeyId/Authorization Credential")) + LOG.info(_LI("No AWSAccessKeyId/Authorization Credential")) raise exception.HeatMissingAuthenticationTokenError() - LOG.info(_("AWS credentials found, checking against keystone.")) + LOG.info(_LI("AWS credentials found, checking against keystone.")) if not auth_uri: - LOG.error(_("Ec2Token authorization failed, no auth_uri " - "specified in config file")) + LOG.error(_LE("Ec2Token authorization failed, no auth_uri " + "specified in config file")) raise exception.HeatInternalFailureError(_('Service ' 'misconfigured')) # Make a copy of args for authentication and signature verification. @@ -182,7 +184,7 @@ class EC2Token(wsgi.Middleware): headers = {'Content-Type': 'application/json'} keystone_ec2_uri = self._conf_get_keystone_ec2_uri(auth_uri) - LOG.info(_('Authenticating with %s') % keystone_ec2_uri) + LOG.info(_LI('Authenticating with %s'), keystone_ec2_uri) response = requests.post(keystone_ec2_uri, data=creds_json, headers=headers) result = response.json() @@ -190,9 +192,9 @@ class EC2Token(wsgi.Middleware): token_id = result['access']['token']['id'] tenant = result['access']['token']['tenant']['name'] tenant_id = result['access']['token']['tenant']['id'] - LOG.info(_("AWS authentication successful.")) + LOG.info(_LI("AWS authentication successful.")) except (AttributeError, KeyError): - LOG.info(_("AWS authentication failure.")) + LOG.info(_LI("AWS authentication failure.")) # Try to extract the reason for failure so we can return the # appropriate AWS error via raising an exception try: diff --git a/heat/api/aws/utils.py b/heat/api/aws/utils.py index fcb5670ec..e77a8ee62 100644 --- a/heat/api/aws/utils.py +++ b/heat/api/aws/utils.py @@ -19,7 +19,7 @@ import itertools import re from heat.api.aws import exception -from heat.common.i18n import _ +from heat.common.i18n import _LE from heat.openstack.common import log as logging LOG = logging.getLogger(__name__) @@ -102,7 +102,7 @@ def get_param_value(params, key): try: return params[key] except KeyError: - LOG.error(_("Request does not contain %s parameter!") % key) + LOG.error(_LE("Request does not contain %s parameter!"), key) raise exception.HeatMissingParameterError(key) diff --git a/heat/api/cfn/v1/stacks.py b/heat/api/cfn/v1/stacks.py index c14ff584d..bb1b5f6ed 100644 --- a/heat/api/cfn/v1/stacks.py +++ b/heat/api/cfn/v1/stacks.py @@ -22,6 +22,7 @@ from heat.api.aws import exception from heat.api.aws import utils as api_utils from heat.common import exception as heat_exception from heat.common.i18n import _ +from heat.common.i18n import _LI from heat.common import identifier from heat.common import policy from heat.common import template_format @@ -421,7 +422,7 @@ class StackController(object): msg = _("The Template must be a JSON or YAML document.") return exception.HeatInvalidParameterValueError(detail=msg) - LOG.info(_('validate_template')) + LOG.info(_LI('validate_template')) def format_validate_parameter(key, value): """ diff --git a/heat/api/cloudwatch/watch.py b/heat/api/cloudwatch/watch.py index 219f50de2..4fb234310 100644 --- a/heat/api/cloudwatch/watch.py +++ b/heat/api/cloudwatch/watch.py @@ -21,6 +21,8 @@ from heat.api.aws import exception from heat.api.aws import utils as api_utils from heat.common import exception as heat_exception from heat.common.i18n import _ +from heat.common.i18n import _LE +from heat.common.i18n import _LW from heat.common import policy from heat.common import wsgi from heat.openstack.common import log as logging @@ -214,7 +216,7 @@ class WatchController(object): # Filter criteria not met, return None return except KeyError: - LOG.warning(_("Invalid filter key %s, ignoring") % f) + LOG.warn(_LW("Invalid filter key %s, ignoring"), f) return result @@ -269,7 +271,7 @@ class WatchController(object): # need to process (each dict) for dimensions metric_data = api_utils.extract_param_list(parms, prefix='MetricData') if not len(metric_data): - LOG.error(_("Request does not contain required MetricData")) + LOG.error(_LE("Request does not contain required MetricData")) return exception.HeatMissingParameterError("MetricData list") watch_name = None diff --git a/heat/api/openstack/v1/stacks.py b/heat/api/openstack/v1/stacks.py index 2cfa3d377..e6703f9a6 100644 --- a/heat/api/openstack/v1/stacks.py +++ b/heat/api/openstack/v1/stacks.py @@ -21,6 +21,7 @@ from webob import exc from heat.api.openstack.v1 import util from heat.api.openstack.v1.views import stacks_view from heat.common import environment_format +from heat.common.i18n import _LW from heat.common import identifier from heat.common import param_utils from heat.common import serializers @@ -204,7 +205,7 @@ class StackController(object): show_deleted=show_deleted, show_nested=show_nested) except AttributeError as exc: - LOG.warning(_("Old Engine Version: %s") % exc) + LOG.warn(_LW("Old Engine Version: %s") % exc) return stacks_view.collection(req, stacks=stacks, count=count, tenant_safe=tenant_safe)