From b54d3d17efd892dc05927cc89fea14dbf1af5ab4 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Thu, 9 Jun 2016 04:44:56 -0700 Subject: [PATCH] Add in missing log hints Add in missing log hints for warnings TrivialFix Change-Id: I70888f9e59744acace08d4ec7afd3eb297d27b95 --- glance/api/middleware/context.py | 4 ++-- glance/async/flows/ovf_process.py | 10 +++++----- glance/common/property_utils.py | 8 ++++---- glance/common/utils.py | 17 +++++++++-------- glance/glare/location.py | 6 +++--- glance/location.py | 6 +++--- 6 files changed, 26 insertions(+), 25 deletions(-) diff --git a/glance/api/middleware/context.py b/glance/api/middleware/context.py index b8838abb..5033b5d8 100644 --- a/glance/api/middleware/context.py +++ b/glance/api/middleware/context.py @@ -21,7 +21,7 @@ import webob.exc from glance.api import policy from glance.common import wsgi import glance.context -from glance.i18n import _ +from glance.i18n import _, _LW context_opts = [ @@ -52,7 +52,7 @@ class BaseContextMiddleware(wsgi.Middleware): try: request_id = resp.request.context.request_id except AttributeError: - LOG.warn(_('Unable to retrieve request id from context')) + LOG.warn(_LW('Unable to retrieve request id from context')) else: # For python 3 compatibility need to use bytes type prefix = b'req-' if isinstance(request_id, bytes) else 'req-' diff --git a/glance/async/flows/ovf_process.py b/glance/async/flows/ovf_process.py index 7b90edab..d5791a6c 100644 --- a/glance/async/flows/ovf_process.py +++ b/glance/async/flows/ovf_process.py @@ -243,11 +243,11 @@ class OVAImageExtractor(object): self.interested_properties = properties.get( 'cim_pasd', []) if not self.interested_properties: - LOG.warn(_('OVF metadata of interest was not specified ' - 'in ovf-metadata.json config file. Please set ' - '"cim_pasd" to a list of interested ' - 'CIM_ProcessorAllocationSettingData ' - 'properties.')) + LOG.warn(_LW('OVF metadata of interest was not specified ' + 'in ovf-metadata.json config file. Please ' + 'set "cim_pasd" to a list of interested ' + 'CIM_ProcessorAllocationSettingData ' + 'properties.')) else: LOG.warn(_('OVF properties config file "ovf-metadata.json" was ' 'not found.')) diff --git a/glance/common/property_utils.py b/glance/common/property_utils.py index e40425ac..3b2ce614 100644 --- a/glance/common/property_utils.py +++ b/glance/common/property_utils.py @@ -21,7 +21,7 @@ from six.moves import configparser import glance.api.policy from glance.common import exception -from glance.i18n import _, _LE +from glance.i18n import _, _LE, _LW CONFIG = configparser.SafeConfigParser() LOG = logging.getLogger(__name__) @@ -125,9 +125,9 @@ class PropertyRules(object): else: property_dict[operation] = [] LOG.warn( - _('Property protection on operation %(operation)s' - ' for rule %(rule)s is not found. No role will be' - ' allowed to perform this operation.') % + _LW('Property protection on operation %(operation)s' + ' for rule %(rule)s is not found. No role will be' + ' allowed to perform this operation.') % {'operation': operation, 'rule': property_exp}) diff --git a/glance/common/utils.py b/glance/common/utils.py index 84c50eb2..cad42607 100644 --- a/glance/common/utils.py +++ b/glance/common/utils.py @@ -44,7 +44,7 @@ import six from webob import exc from glance.common import exception -from glance.i18n import _, _LE +from glance.i18n import _, _LE, _LW CONF = cfg.CONF @@ -421,13 +421,14 @@ def validate_key_cert(key_file, cert_file): data = encodeutils.to_utf8(data) digest = CONF.digest_algorithm if digest == 'sha1': - LOG.warn('The FIPS (FEDERAL INFORMATION PROCESSING STANDARDS)' - ' state that the SHA-1 is not suitable for' - ' general-purpose digital signature applications (as' - ' specified in FIPS 186-3) that require 112 bits of' - ' security. The default value is sha1 in Kilo for a' - ' smooth upgrade process, and it will be updated' - ' with sha256 in next release(L).') + LOG.warn( + _LW('The FIPS (FEDERAL INFORMATION PROCESSING STANDARDS)' + ' state that the SHA-1 is not suitable for' + ' general-purpose digital signature applications (as' + ' specified in FIPS 186-3) that require 112 bits of' + ' security. The default value is sha1 in Kilo for a' + ' smooth upgrade process, and it will be updated' + ' with sha256 in next release(L).')) out = crypto.sign(key, data, digest) crypto.verify(cert, out, data, digest) except crypto.Error as ce: diff --git a/glance/glare/location.py b/glance/glare/location.py index d93a7ac2..8ece66df 100644 --- a/glance/glare/location.py +++ b/glance/glare/location.py @@ -22,7 +22,7 @@ from oslo_utils import encodeutils from glance.common.glare import definitions from glance.common import utils from glance.glare.domain import proxy -from glance.i18n import _, _LE, _LW +from glance.i18n import _LE, _LW CONF = cfg.CONF LOG = logging.getLogger(__name__) @@ -156,8 +156,8 @@ class ArtifactBlobProxy(proxy.ArtifactBlob): context=self.context) return data except Exception as e: - LOG.warn(_('Get blob %(name)s data failed: ' - '%(err)s.') + LOG.warn(_LW('Get blob %(name)s data failed: ' + '%(err)s.') % {'name': self.blob.item_key, 'err': encodeutils.exception_to_unicode(e)}) err = e diff --git a/glance/location.py b/glance/location.py index bfb2ba46..2739a1ca 100644 --- a/glance/location.py +++ b/glance/location.py @@ -27,7 +27,7 @@ from glance.common import exception from glance.common import signature_utils from glance.common import utils import glance.domain.proxy -from glance.i18n import _, _LE, _LI +from glance.i18n import _, _LE, _LI, _LW CONF = cfg.CONF @@ -462,8 +462,8 @@ class ImageProxy(glance.domain.proxy.Image): return data except Exception as e: - LOG.warn(_('Get image %(id)s data failed: ' - '%(err)s.') + LOG.warn(_LW('Get image %(id)s data failed: ' + '%(err)s.') % {'id': self.image.image_id, 'err': encodeutils.exception_to_unicode(e)}) err = e