diff --git a/glance/api/common.py b/glance/api/common.py index cf56137a84..30efcb7b06 100644 --- a/glance/api/common.py +++ b/glance/api/common.py @@ -117,8 +117,8 @@ def get_remaining_quota(context, db_api, image_id=None): if not match: LOG.error(_LE("Invalid value for option user_storage_quota: " - "%(users_quota)s") - % {'users_quota': users_quota}) + "%(users_quota)s"), + {'users_quota': users_quota}) raise exception.InvalidOptionValue(option='user_storage_quota', value=users_quota) @@ -166,8 +166,8 @@ def check_quota(context, image_size, db_api, image_id=None): if remaining <= 0: LOG.warn(_LW("User %(user)s attempted to upload an image of" " unknown size that will exceed the quota." - " %(remaining)d bytes remaining.") - % {'user': user, 'remaining': remaining}) + " %(remaining)d bytes remaining."), + {'user': user, 'remaining': remaining}) raise exception.StorageQuotaFull(image_size=image_size, remaining=remaining) return @@ -175,8 +175,8 @@ def check_quota(context, image_size, db_api, image_id=None): if image_size > remaining: LOG.warn(_LW("User %(user)s attempted to upload an image of size" " %(size)d that will exceed the quota. %(remaining)d" - " bytes remaining.") - % {'user': user, 'size': image_size, 'remaining': remaining}) + " bytes remaining."), + {'user': user, 'size': image_size, 'remaining': remaining}) raise exception.StorageQuotaFull(image_size=image_size, remaining=remaining) diff --git a/glance/api/middleware/cache.py b/glance/api/middleware/cache.py index 3072c714cb..6eb0795c22 100644 --- a/glance/api/middleware/cache.py +++ b/glance/api/middleware/cache.py @@ -272,7 +272,7 @@ class CacheFilter(wsgi.Middleware): try: process_response_method = getattr(self, method_str) except AttributeError: - LOG.error(_LE('could not find %s') % method_str) + LOG.error(_LE('could not find %s'), method_str) # Nothing to do here, move along return resp else: diff --git a/glance/api/v1/upload_utils.py b/glance/api/v1/upload_utils.py index a4710ee76b..2d52575ce7 100644 --- a/glance/api/v1/upload_utils.py +++ b/glance/api/v1/upload_utils.py @@ -73,7 +73,7 @@ def safe_kill(req, image_id, from_state): try: _kill(req, image_id, from_state) except Exception: - LOG.exception(_LE("Unable to kill image %(id)s: ") % {'id': image_id}) + LOG.exception(_LE("Unable to kill image %(id)s: "), {'id': image_id}) def upload_data_to_store(req, image_meta, image_data, store, notifier): @@ -172,7 +172,7 @@ def upload_data_to_store(req, image_meta, image_data, store, notifier): # Delete image data due to possible token expiration. LOG.debug("Authentication error - the token may have " "expired during file upload. Deleting image data for " - " %s " % image_id) + " %s", image_id) initiate_deletion(req, location_data, image_id) raise webob.exc.HTTPUnauthorized(explanation=e.msg, request=req) except exception.ImageNotFound: diff --git a/glance/common/location_strategy/__init__.py b/glance/common/location_strategy/__init__.py index c96f501267..dd4bc7b4d6 100644 --- a/glance/common/location_strategy/__init__.py +++ b/glance/common/location_strategy/__init__.py @@ -82,8 +82,8 @@ def _load_strategies(): modules[strategy_name] = mgr.driver except Exception as e: LOG.error(_LE("Failed to load location strategy module " - "%(module)s: %(e)s") % {'module': module_name, - 'e': e}) + "%(module)s: %(e)s"), {'module': module_name, + 'e': e}) return modules diff --git a/glance/db/simple/api.py b/glance/db/simple/api.py index 66b64e70ec..40d11213be 100644 --- a/glance/db/simple/api.py +++ b/glance/db/simple/api.py @@ -430,7 +430,7 @@ def _image_get(context, image_id, force_show_deleted=False, status=None): try: image = DATA['images'][image_id] except KeyError: - LOG.warn(_LW('Could not find image %s') % image_id) + LOG.warn(_LW('Could not find image %s'), image_id) raise exception.ImageNotFound() if image['deleted'] and not (force_show_deleted diff --git a/glance/image_cache/prefetcher.py b/glance/image_cache/prefetcher.py index 6305865921..03ea26ffa5 100644 --- a/glance/image_cache/prefetcher.py +++ b/glance/image_cache/prefetcher.py @@ -46,7 +46,7 @@ class Prefetcher(base.CacheApp): image_repo = self.gateway.get_repo(ctx) image = image_repo.get(image_id) except exception.NotFound: - LOG.warn(_LW("Image '%s' not found") % image_id) + LOG.warning(_LW("Image '%s' not found"), image_id) return False if image.status != 'active': diff --git a/glance/location.py b/glance/location.py index b4f3e762d7..e2ecd901e6 100644 --- a/glance/location.py +++ b/glance/location.py @@ -540,14 +540,13 @@ class ImageProxy(glance.domain.proxy.Image): return data except Exception as e: LOG.warn(_LW('Get image %(id)s data failed: ' - '%(err)s.') - % {'id': self.image.image_id, - 'err': encodeutils.exception_to_unicode(e)}) + '%(err)s.'), + {'id': self.image.image_id, + 'err': encodeutils.exception_to_unicode(e)}) err = e # tried all locations - LOG.error(_LE( - 'Glance tried all active locations/stores to get data ' - 'for image %s but all have failed.') % self.image.image_id) + LOG.error(_LE('Glance tried all active locations to get data for ' + 'image %s but all have failed.'), self.image.image_id) raise err diff --git a/glance/registry/api/v1/images.py b/glance/registry/api/v1/images.py index 7fc00d9ddc..322a70035a 100644 --- a/glance/registry/api/v1/images.py +++ b/glance/registry/api/v1/images.py @@ -122,12 +122,12 @@ class Controller(object): v1_mode=True, **params) except exception.ImageNotFound: LOG.warn(_LW("Invalid marker. Image %(id)s could not be " - "found.") % {'id': params.get('marker')}) + "found."), {'id': params.get('marker')}) msg = _("Invalid marker. Image could not be found.") raise exc.HTTPBadRequest(explanation=msg) except exception.Forbidden: LOG.warn(_LW("Access denied to image %(id)s but returning " - "'not found'") % {'id': params.get('marker')}) + "'not found'"), {'id': params.get('marker')}) msg = _("Invalid marker. Image could not be found.") raise exc.HTTPBadRequest(explanation=msg) except Exception: @@ -370,7 +370,7 @@ class Controller(object): " 'not found'"), {'id': id}) raise exc.HTTPNotFound() except Exception: - LOG.exception(_LE("Unable to show image %s") % id) + LOG.exception(_LE("Unable to show image %s"), id) raise return dict(image=make_image_dict(image)) @@ -403,7 +403,7 @@ class Controller(object): LOG.info(_LI("Image %(id)s not found"), {'id': id}) return exc.HTTPNotFound() except Exception: - LOG.exception(_LE("Unable to delete image %s") % id) + LOG.exception(_LE("Unable to delete image %s"), id) raise @utils.mutating @@ -527,7 +527,7 @@ class Controller(object): request=req, content_type='text/plain') except Exception: - LOG.exception(_LE("Unable to update image %s") % id) + LOG.exception(_LE("Unable to update image %s"), id) raise diff --git a/glance/scrubber.py b/glance/scrubber.py index 723093f7a2..410494a0fc 100644 --- a/glance/scrubber.py +++ b/glance/scrubber.py @@ -386,7 +386,7 @@ class Scrubber(object): else: LOG.warn(_LW("One or more image locations couldn't be scrubbed " "from backend. Leaving image '%s' in 'pending_delete'" - " status") % image_id) + " status"), image_id) def _delete_image_location_from_backend(self, image_id, loc_id, uri, backend=None):