From e2c8b23129bc32ad1ebe5ed19864f84f334c6616 Mon Sep 17 00:00:00 2001 From: kairat_kushaev Date: Tue, 29 Sep 2015 19:12:30 +0300 Subject: [PATCH] Format log messages correctly Postpone formatting of log messages until check that debug is turned on. It allows not to format and prepare formatted log messages if debug mode is turned off. Change-Id: Ic26a2940948fe9891e4898689e2ea9fc7f0d4350 --- glance/api/middleware/version_negotiation.py | 5 +- glance/api/v1/controller.py | 15 +- glance/api/v1/images.py | 6 +- glance/api/v2/metadef_namespaces.py | 5 +- glance/async/flows/base_import.py | 2 +- glance/async/flows/introspect.py | 4 +- glance/async/taskflow_executor.py | 4 +- glance/cmd/replicator.py | 40 ++--- glance/common/client.py | 5 +- glance/common/scripts/image_import/main.py | 7 +- glance/common/wsgi.py | 2 +- glance/db/simple/api.py | 150 ++++++++---------- glance/db/sqlalchemy/api.py | 8 +- glance/db/sqlalchemy/artifacts.py | 2 +- glance/db/sqlalchemy/metadef_api/namespace.py | 37 ++--- glance/db/sqlalchemy/metadef_api/object.py | 25 ++- glance/db/sqlalchemy/metadef_api/property.py | 29 ++-- .../sqlalchemy/metadef_api/resource_type.py | 21 ++- .../metadef_api/resource_type_association.py | 24 ++- glance/db/sqlalchemy/metadef_api/tag.py | 36 ++--- glance/domain/__init__.py | 12 +- glance/image_cache/drivers/xattr.py | 6 +- glance/registry/api/v1/images.py | 3 +- glance/registry/client/v1/client.py | 9 +- glance/scrubber.py | 4 +- 25 files changed, 202 insertions(+), 259 deletions(-) diff --git a/glance/api/middleware/version_negotiation.py b/glance/api/middleware/version_negotiation.py index 06c90165c4..cadd6f013f 100644 --- a/glance/api/middleware/version_negotiation.py +++ b/glance/api/middleware/version_negotiation.py @@ -41,10 +41,9 @@ class VersionNegotiationFilter(wsgi.Middleware): def process_request(self, req): """Try to find a version first in the accept header, then the URL""" - msg = _("Determining version of request: %(method)s %(path)s" - " Accept: %(accept)s") args = {'method': req.method, 'path': req.path, 'accept': req.accept} - LOG.debug(msg % args) + LOG.debug("Determining version of request: %(method)s %(path)s " + "Accept: %(accept)s", args) # If the request is for /versions, just return the versions container if req.path_info_peek() == "versions": diff --git a/glance/api/v1/controller.py b/glance/api/v1/controller.py index 897838bd55..a660a1c317 100644 --- a/glance/api/v1/controller.py +++ b/glance/api/v1/controller.py @@ -41,14 +41,13 @@ class BaseController(object): try: return registry.get_image_metadata(context, image_id) except exception.NotFound: - msg = "Image with identifier %s not found" % image_id - LOG.debug(msg) + LOG.debug("Image with identifier %s not found", image_id) + msg = _("Image with identifier %s not found") % image_id raise webob.exc.HTTPNotFound( msg, request=request, content_type='text/plain') except exception.Forbidden: - msg = "Forbidden image access" - LOG.debug(msg) - raise webob.exc.HTTPForbidden(msg, + LOG.debug("Forbidden image access") + raise webob.exc.HTTPForbidden(_("Forbidden image access"), request=request, content_type='text/plain') @@ -59,14 +58,12 @@ class BaseController(object): """ image = self.get_image_meta_or_404(request, image_id) if image['status'] == 'deactivated': - msg = "Image %s is deactivated" % image_id - LOG.debug(msg) + LOG.debug("Image %s is deactivated", image_id) msg = _("Image %s is deactivated") % image_id raise webob.exc.HTTPForbidden( msg, request=request, content_type='text/plain') if image['status'] != 'active': - msg = "Image %s is not active" % image_id - LOG.debug(msg) + LOG.debug("Image %s is not active", image_id) msg = _("Image %s is not active") % image_id raise webob.exc.HTTPNotFound( msg, request=request, content_type='text/plain') diff --git a/glance/api/v1/images.py b/glance/api/v1/images.py index 243bd71a75..e2c73d280d 100644 --- a/glance/api/v1/images.py +++ b/glance/api/v1/images.py @@ -171,7 +171,7 @@ class Controller(controller.BaseController): try: self.policy.enforce(req.context, action, target) except exception.Forbidden: - LOG.debug("User not permitted to perform '%s' action" % action) + LOG.debug("User not permitted to perform '%s' action", action) raise HTTPForbidden() def _enforce_image_property_quota(self, @@ -553,8 +553,8 @@ class Controller(controller.BaseController): try: backend = store.get_store_from_location(location) except (store.UnknownScheme, store.BadStoreUri): + LOG.debug("Invalid location %s", location) msg = _("Invalid location %s") % location - LOG.debug(msg) raise HTTPBadRequest(explanation=msg, request=req, content_type="text/plain") @@ -687,7 +687,7 @@ class Controller(controller.BaseController): # Delete image data since it has been superseded by another # upload and re-raise. LOG.debug("duplicate operation - deleting image data for " - " %(id)s (location:%(location)s)" % + " %(id)s (location:%(location)s)", {'id': image_id, 'location': image_meta['location']}) upload_utils.initiate_deletion(req, location_data, image_id) except exception.Invalid as e: diff --git a/glance/api/v2/metadef_namespaces.py b/glance/api/v2/metadef_namespaces.py index 915dbc2ff7..1d2a72def5 100644 --- a/glance/api/v2/metadef_namespaces.py +++ b/glance/api/v2/metadef_namespaces.py @@ -202,9 +202,8 @@ class NamespaceController(object): namespace_obj = namespace_repo.get(namespace.namespace) namespace_obj.delete() namespace_repo.remove(namespace_obj) - msg = ("Cleaned up namespace %(namespace)s " - % {'namespace': namespace.namespace}) - LOG.debug(msg) + LOG.debug("Cleaned up namespace %(namespace)s ", + {'namespace': namespace.namespace}) except exception: msg = (_LE("Failed to delete namespace %(namespace)s ") % {'namespace': namespace.namespace}) diff --git a/glance/async/flows/base_import.py b/glance/async/flows/base_import.py index e884e96e74..3804940cc3 100644 --- a/glance/async/flows/base_import.py +++ b/glance/async/flows/base_import.py @@ -68,7 +68,7 @@ class _CreateImage(task.Task): self.image_repo, self.image_factory, task_input.get('image_properties'), self.task_id) - LOG.debug("Task %(task_id)s created image %(image_id)s" % + LOG.debug("Task %(task_id)s created image %(image_id)s", {'task_id': task.task_id, 'image_id': image.image_id}) return image.image_id diff --git a/glance/async/flows/introspect.py b/glance/async/flows/introspect.py index 8784d4f302..ad65e6aa37 100644 --- a/glance/async/flows/introspect.py +++ b/glance/async/flows/introspect.py @@ -70,7 +70,7 @@ class _Introspect(utils.OptionalTask): new_image.virtual_size = metadata.get('virtual-size', 0) new_image.disk_format = metadata.get('format') self.image_repo.save(new_image) - LOG.debug("%(task_id)s: Introspection successful: %(file)s" % + LOG.debug("%(task_id)s: Introspection successful: %(file)s", {'task_id': self.task_id, 'file': file_path}) return new_image @@ -87,7 +87,7 @@ def get_flow(**kwargs): task_type = kwargs.get('task_type') image_repo = kwargs.get('image_repo') - LOG.debug("Flow: %(task_type)s with ID %(id)s on %(repo)s" % + LOG.debug("Flow: %(task_type)s with ID %(id)s on %(repo)s", {'task_type': task_type, 'id': task_id, 'repo': image_repo}) return lf.Flow(task_type).add( diff --git a/glance/async/taskflow_executor.py b/glance/async/taskflow_executor.py index c23418c1ad..250eebae1e 100644 --- a/glance/async/taskflow_executor.py +++ b/glance/async/taskflow_executor.py @@ -107,8 +107,8 @@ class TaskExecutor(glance.async.TaskExecutor): def _run(self, task_id, task_type): LOG.debug('Taskflow executor picked up the execution of task ID ' '%(task_id)s of task type ' - '%(task_type)s' % {'task_id': task_id, - 'task_type': task_type}) + '%(task_type)s', {'task_id': task_id, + 'task_type': task_type}) task = script_utils.get_task(self.task_repo, task_id) if task is None: diff --git a/glance/cmd/replicator.py b/glance/cmd/replicator.py index d0f6744b7c..295ce9bda0 100755 --- a/glance/cmd/replicator.py +++ b/glance/cmd/replicator.py @@ -140,22 +140,22 @@ class ImageService(object): headers.setdefault('x-auth-token', self.auth_token) LOG.debug('Request: %(method)s http://%(server)s:%(port)s' - '%(url)s with headers %(headers)s' - % {'method': method, - 'server': self.conn.host, - 'port': self.conn.port, - 'url': url, - 'headers': repr(headers)}) + '%(url)s with headers %(headers)s', + {'method': method, + 'server': self.conn.host, + 'port': self.conn.port, + 'url': url, + 'headers': repr(headers)}) self.conn.request(method, url, body, headers) response = self.conn.getresponse() headers = self._header_list_to_dict(response.getheaders()) code = response.status code_description = http_client.responses[code] - LOG.debug('Response: %(code)s %(status)s %(headers)s' - % {'code': code, - 'status': code_description, - 'headers': repr(headers)}) + LOG.debug('Response: %(code)s %(status)s %(headers)s', + {'code': code, + 'status': code_description, + 'headers': repr(headers)}) if code == 400: raise exc.HTTPBadRequest( @@ -338,7 +338,7 @@ def replication_size(options, args): client = imageservice(http_client.HTTPConnection(server, port), options.slavetoken) for image in client.get_images(): - LOG.debug('Considering image: %(image)s' % {'image': image}) + LOG.debug('Considering image: %(image)s', {'image': image}) if image['status'] == 'active': total_size += int(image['size']) count += 1 @@ -368,7 +368,7 @@ def replication_dump(options, args): client = imageservice(http_client.HTTPConnection(server, port), options.mastertoken) for image in client.get_images(): - LOG.debug('Considering: %s' % image['id']) + LOG.debug('Considering: %s', image['id']) data_path = os.path.join(path, image['id']) if not os.path.exists(data_path): @@ -387,7 +387,7 @@ def replication_dump(options, args): # is the same as that which we got from the detailed images # request earlier, so we can ignore it here. Note that we also # only dump active images. - LOG.debug('Image %s is active' % image['id']) + LOG.debug('Image %s is active', image['id']) image_response = client.get_image(image['id']) with open(data_path + '.img', 'wb') as f: while True: @@ -407,15 +407,15 @@ def _dict_diff(a, b): """ # Only things the master has which the slave lacks matter if set(a.keys()) - set(b.keys()): - LOG.debug('metadata diff -- master has extra keys: %(keys)s' - % {'keys': ' '.join(set(a.keys()) - set(b.keys()))}) + LOG.debug('metadata diff -- master has extra keys: %(keys)s', + {'keys': ' '.join(set(a.keys()) - set(b.keys()))}) return True for key in a: if str(a[key]) != str(b[key]): LOG.debug('metadata diff -- value differs for key ' '%(key)s: master "%(master_value)s" vs ' - 'slave "%(slave_value)s"' % + 'slave "%(slave_value)s"', {'key': key, 'master_value': a[key], 'slave_value': b[key]}) @@ -482,7 +482,7 @@ def replication_load(options, args): else: if not os.path.exists(os.path.join(path, image_uuid + '.img')): - LOG.debug('%s dump is missing image data, skipping' % + LOG.debug('%s dump is missing image data, skipping', image_uuid) continue @@ -525,7 +525,7 @@ def replication_livecopy(options, args): updated = [] for image in master_client.get_images(): - LOG.debug('Considering %(id)s' % {'id': image['id']}) + LOG.debug('Considering %(id)s', {'id': image['id']}) for key in options.dontreplicate.split(' '): if key in image: LOG.debug('Stripping %(header)s from master metadata', @@ -618,8 +618,8 @@ def replication_compare(options, args): 'slave_value': headers.get(key, 'undefined')}) differences[image['id']] = 'diff' else: - LOG.debug('%(image_id)s is identical' - % {'image_id': image['id']}) + LOG.debug('%(image_id)s is identical', + {'image_id': image['id']}) elif image['status'] == 'active': LOG.warn(_LW('Image %s entirely missing from the destination') diff --git a/glance/common/client.py b/glance/common/client.py index d7b5b49fee..3bfa91188c 100644 --- a/glance/common/client.py +++ b/glance/common/client.py @@ -307,9 +307,8 @@ class BaseClient(object): if self.DEFAULT_DOC_ROOT: doc_root = self.DEFAULT_DOC_ROOT.lstrip('/') self.doc_root += '/' + doc_root - msg = ("Appending doc_root %(doc_root)s to URL %(url)s" % - {'doc_root': doc_root, 'url': url}) - LOG.debug(msg) + LOG.debug("Appending doc_root %(doc_root)s to URL %(url)s", + {'doc_root': doc_root, 'url': url}) # ensure connection kwargs are re-evaluated after the service catalog # publicURL is parsed for potential SSL usage diff --git a/glance/common/scripts/image_import/main.py b/glance/common/scripts/image_import/main.py index f62d2a41c3..6b2df02df7 100644 --- a/glance/common/scripts/image_import/main.py +++ b/glance/common/scripts/image_import/main.py @@ -132,10 +132,9 @@ def create_image(image_repo, image_factory, image_properties, task_id): try: properties[key] = image_properties.pop(key) except KeyError: - msg = ("Task ID %(task_id)s: Ignoring property %(k)s for setting " - "base properties while creating " - "Image.") % {'task_id': task_id, 'k': key} - LOG.debug(msg) + LOG.debug("Task ID %(task_id)s: Ignoring property %(k)s for " + "setting base properties while creating " + "Image.", {'task_id': task_id, 'k': key}) # NOTE: get the rest of the properties and pass them as # extra_properties for Image to be created with them. diff --git a/glance/common/wsgi.py b/glance/common/wsgi.py index 2a14e1b1f9..243edb9fe0 100644 --- a/glance/common/wsgi.py +++ b/glance/common/wsgi.py @@ -645,7 +645,7 @@ class APIMapper(routes.Mapper): class RejectMethodController(object): def reject(self, req, allowed_methods, *args, **kwargs): - LOG.debug("The method %s is not allowed for this resource" % + LOG.debug("The method %s is not allowed for this resource", req.environ['REQUEST_METHOD']) raise webob.exc.HTTPMethodNotAllowed( headers=[('Allow', allowed_methods)]) diff --git a/glance/db/simple/api.py b/glance/db/simple/api.py index df23daa082..ba08c42dc2 100644 --- a/glance/db/simple/api.py +++ b/glance/db/simple/api.py @@ -892,8 +892,7 @@ def task_update(context, task_id, values): try: task = DATA['tasks'][task_id] except KeyError: - msg = "No task found with ID %s" % task_id - LOG.debug(msg) + LOG.debug("No task found with ID %s", task_id) raise exception.TaskNotFound(task_id=task_id) task.update(task_values) @@ -924,8 +923,7 @@ def _task_get(context, task_id, force_show_deleted=False): raise exception.TaskNotFound(task_id=task_id) if not _is_task_visible(context, task): - msg = "Forbidding request, task %s is not visible" % task_id - LOG.debug(msg) + LOG.debug("Forbidding request, task %s is not visible", task_id) msg = _("Forbidding request, task %s is not visible") % task_id raise exception.Forbidden(msg) @@ -943,8 +941,7 @@ def task_delete(context, task_id): DATA['tasks'][task_id]['updated_at'] = timeutils.utcnow() return copy.deepcopy(DATA['tasks'][task_id]) except KeyError: - msg = "No task found with ID %s" % task_id - LOG.debug(msg) + LOG.debug("No task found with ID %s", task_id) raise exception.TaskNotFound(task_id=task_id) @@ -1064,8 +1061,7 @@ def _task_info_update(task_id, values): try: task_info = DATA['task_info'][task_id] except KeyError: - msg = "No task info found with task id %s" % task_id - LOG.debug(msg) + LOG.debug("No task info found with task id %s", task_id) raise exception.TaskNotFound(task_id=task_id) task_info.update(values) @@ -1109,9 +1105,8 @@ def metadef_namespace_create(context, values): for namespace in DATA['metadef_namespaces']: if namespace['namespace'] == namespace_name: - msg = ("Can not create the metadata definition namespace. " - "Namespace=%s already exists.") % namespace_name - LOG.debug(msg) + LOG.debug("Can not create the metadata definition namespace. " + "Namespace=%s already exists.", namespace_name) raise exception.MetadefDuplicateNamespace( namespace_name=namespace_name) @@ -1140,11 +1135,9 @@ def metadef_namespace_update(context, namespace_id, values): if namespace['namespace'] != values['namespace']: for db_namespace in DATA['metadef_namespaces']: if db_namespace['namespace'] == values['namespace']: - msg = ("Invalid update. It would result in a duplicate" - " metadata definition namespace with the same" - " name of %s" - % values['namespace']) - LOG.debug(msg) + LOG.debug("Invalid update. It would result in a duplicate " + "metadata definition namespace with the same " + "name of %s", values['namespace']) emsg = (_("Invalid update. It would result in a duplicate" " metadata definition namespace with the same" " name of %s") @@ -1172,11 +1165,10 @@ def metadef_namespace_get_by_id(context, namespace_id): raise exception.MetadefNamespaceNotFound(msg) if not _is_namespace_visible(context, namespace): - msg = ("Forbidding request, metadata definition namespace=%s" - " is not visible.") % namespace.namespace - LOG.debug(msg) - emsg = _("Forbidding request, metadata definition namespace=%s" - " is not visible.") % namespace.namespace + LOG.debug("Forbidding request, metadata definition namespace=%s " + "is not visible.", namespace.namespace) + emsg = _("Forbidding request, metadata definition namespace=%s " + "is not visible.") % namespace.namespace raise exception.MetadefForbidden(emsg) return namespace @@ -1189,8 +1181,7 @@ def metadef_namespace_get(context, namespace_name): namespace = next(namespace for namespace in DATA['metadef_namespaces'] if namespace['namespace'] == namespace_name) except StopIteration: - msg = "No namespace found with name %s" % namespace_name - LOG.debug(msg) + LOG.debug("No namespace found with name %s", namespace_name) raise exception.MetadefNamespaceNotFound( namespace_name=namespace_name) @@ -1280,10 +1271,9 @@ def metadef_object_get(context, namespace_name, object_name): object['name'] == object_name): return object else: - msg = ("The metadata definition object with name=%(name)s" - " was not found in namespace=%(namespace_name)s." - % {'name': object_name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("The metadata definition object with name=%(name)s" + " was not found in namespace=%(namespace_name)s.", + {'name': object_name, 'namespace_name': namespace_name}) raise exception.MetadefObjectNotFound(namespace_name=namespace_name, object_name=object_name) @@ -1337,10 +1327,9 @@ def metadef_object_create(context, namespace_name, values): for object in DATA['metadef_objects']: if (object['name'] == object_name and object['namespace_id'] == namespace['id']): - msg = ("A metadata definition object with name=%(name)s" - " in namespace=%(namespace_name)s already exists." - % {'name': object_name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("A metadata definition object with name=%(name)s " + "in namespace=%(namespace_name)s already exists.", + {'name': object_name, 'namespace_name': namespace_name}) raise exception.MetadefDuplicateObject( object_name=object_name, namespace_name=namespace_name) @@ -1377,12 +1366,11 @@ def metadef_object_update(context, namespace_name, object_id, values): for db_object in DATA['metadef_objects']: if (db_object['name'] == values['name'] and db_object['namespace_id'] == namespace['id']): - msg = ("Invalid update. It would result in a duplicate" - " metadata definition object with same name=%(name)s " - " in namespace=%(namespace_name)s." - % {'name': object['name'], - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("Invalid update. It would result in a duplicate " + "metadata definition object with same name=%(name)s " + "in namespace=%(namespace_name)s.", + {'name': object['name'], + 'namespace_name': namespace_name}) emsg = (_("Invalid update. It would result in a duplicate" " metadata definition object with the same" " name=%(name)s " @@ -1462,12 +1450,11 @@ def metadef_property_create(context, namespace_name, values): for property in DATA['metadef_properties']: if (property['name'] == property_name and property['namespace_id'] == namespace['id']): - msg = ("Can not create metadata definition property. A property" - " with name=%(name)s already exists in" - " namespace=%(namespace_name)s." - % {'name': property_name, - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("Can not create metadata definition property. A property" + " with name=%(name)s already exists in" + " namespace=%(namespace_name)s.", + {'name': property_name, + 'namespace_name': namespace_name}) raise exception.MetadefDuplicateProperty( property_name=property_name, namespace_name=namespace_name) @@ -1505,13 +1492,12 @@ def metadef_property_update(context, namespace_name, property_id, values): for db_property in DATA['metadef_properties']: if (db_property['name'] == values['name'] and db_property['namespace_id'] == namespace['id']): - msg = ("Invalid update. It would result in a duplicate" - " metadata definition property with the same" - " name=%(name)s" - " in namespace=%(namespace_name)s." - % {'name': property['name'], - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("Invalid update. It would result in a duplicate" + " metadata definition property with the same" + " name=%(name)s" + " in namespace=%(namespace_name)s.", + {'name': property['name'], + 'namespace_name': namespace_name}) emsg = (_("Invalid update. It would result in a duplicate" " metadata definition property with the same" " name=%(name)s" @@ -1574,10 +1560,9 @@ def metadef_property_get(context, namespace_name, property_name): property['name'] == property_name): return property else: - msg = ("No property found with name=%(name)s in" - " namespace=%(namespace_name)s " - % {'name': property_name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("No property found with name=%(name)s in" + " namespace=%(namespace_name)s ", + {'name': property_name, 'namespace_name': namespace_name}) raise exception.MetadefPropertyNotFound(namespace_name=namespace_name, property_name=property_name) @@ -1641,8 +1626,7 @@ def metadef_resource_type_get(context, resource_type_name): if resource_type['name'] == resource_type_name) except StopIteration: - msg = "No resource type found with name %s" % resource_type_name - LOG.debug(msg) + LOG.debug("No resource type found with name %s", resource_type_name) raise exception.MetadefResourceTypeNotFound( resource_type_name=resource_type_name) @@ -1667,12 +1651,11 @@ def metadef_resource_type_association_create(context, namespace_name, for association in DATA['metadef_namespace_resource_types']: if (association['namespace_id'] == namespace['id'] and association['resource_type'] == resource_type['id']): - msg = ("The metadata definition resource-type association of" - " resource_type=%(resource_type_name)s to" - " namespace=%(namespace_name)s, already exists." - % {'resource_type_name': resource_type_name, - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("The metadata definition resource-type association of" + " resource_type=%(resource_type_name)s to" + " namespace=%(namespace_name)s, already exists.", + {'resource_type_name': resource_type_name, + 'namespace_name': namespace_name}) raise exception.MetadefDuplicateResourceTypeAssociation( resource_type_name=resource_type_name, namespace_name=namespace_name) @@ -1704,9 +1687,9 @@ def metadef_resource_type_association_get(context, namespace_name, association['resource_type'] == resource_type['id']): return association else: - msg = ("No resource type association found associated with namespace " - "%s and resource type %s" % namespace_name, resource_type_name) - LOG.debug(msg) + LOG.debug("No resource type association found associated with " + "namespace %s and resource type %s", namespace_name, + resource_type_name) raise exception.MetadefResourceTypeAssociationNotFound( resource_type_name=resource_type_name, namespace_name=namespace_name) @@ -1748,10 +1731,9 @@ def metadef_tag_get(context, namespace_name, name): if tag['namespace_id'] == namespace['id'] and tag['name'] == name: return tag else: - msg = ("The metadata definition tag with name=%(name)s" - " was not found in namespace=%(namespace_name)s." - % {'name': name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("The metadata definition tag with name=%(name)s" + " was not found in namespace=%(namespace_name)s.", + {'name': name, 'namespace_name': namespace_name}) raise exception.MetadefTagNotFound(name=name, namespace_name=namespace_name) @@ -1802,10 +1784,9 @@ def metadef_tag_create(context, namespace_name, values): for tag in DATA['metadef_tags']: if tag['name'] == tag_name and tag['namespace_id'] == namespace['id']: - msg = ("A metadata definition tag with name=%(name)s" - " in namespace=%(namespace_name)s already exists." - % {'name': tag_name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("A metadata definition tag with name=%(name)s" + " in namespace=%(namespace_name)s already exists.", + {'name': tag_name, 'namespace_name': namespace_name}) raise exception.MetadefDuplicateTag( name=tag_name, namespace_name=namespace_name) @@ -1853,10 +1834,9 @@ def metadef_tag_create_tags(context, namespace_name, tag_list): 'The keys %s are not valid' % str(incorrect_keys)) if tag_name in tag_name_list: - msg = ("A metadata definition tag with name=%(name)s" - " in namespace=%(namespace_name)s already exists." - % {'name': tag_name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("A metadata definition tag with name=%(name)s" + " in namespace=%(namespace_name)s already exists.", + {'name': tag_name, 'namespace_name': namespace_name}) raise exception.MetadefDuplicateTag( name=tag_name, namespace_name=namespace_name) else: @@ -1886,12 +1866,11 @@ def metadef_tag_update(context, namespace_name, id, values): for db_tag in DATA['metadef_tags']: if (db_tag['name'] == values['name'] and db_tag['namespace_id'] == namespace['id']): - msg = ("Invalid update. It would result in a duplicate" - " metadata definition tag with same name=%(name)s " - " in namespace=%(namespace_name)s." - % {'name': tag['name'], - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("Invalid update. It would result in a duplicate" + " metadata definition tag with same name=%(name)s " + " in namespace=%(namespace_name)s.", + {'name': tag['name'], + 'namespace_name': namespace_name}) raise exception.MetadefDuplicateTag( name=tag['name'], namespace_name=namespace_name) @@ -2130,9 +2109,8 @@ def _is_namespace_visible(context, namespace): def _check_namespace_visibility(context, namespace, namespace_name): if not _is_namespace_visible(context, namespace): - msg = ("Forbidding request, metadata definition namespace=%s" - " is not visible." % namespace_name) - LOG.debug(msg) + LOG.debug("Forbidding request, metadata definition namespace=%s " + "is not visible.", namespace_name) emsg = _("Forbidding request, metadata definition namespace=%s" " is not visible.") % namespace_name raise exception.MetadefForbidden(emsg) diff --git a/glance/db/sqlalchemy/api.py b/glance/db/sqlalchemy/api.py index 8700469fd8..222489fc31 100644 --- a/glance/db/sqlalchemy/api.py +++ b/glance/db/sqlalchemy/api.py @@ -1252,9 +1252,8 @@ def _task_info_get(context, task_id, session=None): try: task_info_ref = query.one() except sa_orm.exc.NoResultFound: - msg = ("TaskInfo was not found for task with id %(task_id)s" % - {'task_id': task_id}) - LOG.debug(msg) + LOG.debug("TaskInfo was not found for task with id %(task_id)s", + {'task_id': task_id}) task_info_ref = None return task_info_ref @@ -1417,8 +1416,7 @@ def _task_get(context, task_id, session=None, force_show_deleted=False): try: task_ref = query.one() except sa_orm.exc.NoResultFound: - msg = "No task found with ID %s" % task_id - LOG.debug(msg) + LOG.debug("No task found with ID %s", task_id) raise exception.TaskNotFound(task_id=task_id) # Make sure the task is visible diff --git a/glance/db/sqlalchemy/artifacts.py b/glance/db/sqlalchemy/artifacts.py index 6e919a7335..215541f353 100644 --- a/glance/db/sqlalchemy/artifacts.py +++ b/glance/db/sqlalchemy/artifacts.py @@ -425,7 +425,7 @@ def _do_paginate_query(query, sort_keys=None, sort_dirs=None, def _do_artifacts_query(context, session, show_level=ga.Showlevel.NONE): """Build the query to get all artifacts based on the context""" - LOG.debug("context.is_admin=%(is_admin)s; context.owner=%(owner)s" % + LOG.debug("context.is_admin=%(is_admin)s; context.owner=%(owner)s", {'is_admin': context.is_admin, 'owner': context.owner}) if show_level == ga.Showlevel.NONE: diff --git a/glance/db/sqlalchemy/metadef_api/namespace.py b/glance/db/sqlalchemy/metadef_api/namespace.py index dc64c640fc..eab7155eab 100644 --- a/glance/db/sqlalchemy/metadef_api/namespace.py +++ b/glance/db/sqlalchemy/metadef_api/namespace.py @@ -56,7 +56,7 @@ def _is_namespace_visible(context, namespace, status=None): def _select_namespaces_query(context, session): """Build the query to get all namespaces based on the context""" - LOG.debug("context.is_admin=%(is_admin)s; context.owner=%(owner)s" % + LOG.debug("context.is_admin=%(is_admin)s; context.owner=%(owner)s", {'is_admin': context.is_admin, 'owner': context.owner}) # If admin, return everything. @@ -93,9 +93,8 @@ def _get(context, namespace_id, session): # Make sure they are allowed to view it. if not _is_namespace_visible(context, namespace_rec.to_dict()): - msg = ("Forbidding request, metadata definition namespace=%s" - " is not visible.") % namespace_rec.namespace - LOG.debug(msg) + LOG.debug("Forbidding request, metadata definition namespace=%s" + " is not visible.", namespace_rec.namespace) emsg = _("Forbidding request, metadata definition namespace=%s" " is not visible.") % namespace_rec.namespace raise exc.MetadefForbidden(emsg) @@ -111,15 +110,13 @@ def _get_by_name(context, name, session): namespace=name) namespace_rec = query.one() except sa_orm.exc.NoResultFound: - msg = "Metadata definition namespace=%s was not found." % name - LOG.debug(msg) + LOG.debug("Metadata definition namespace=%s was not found.", name) raise exc.MetadefNamespaceNotFound(namespace_name=name) # Make sure they are allowed to view it. if not _is_namespace_visible(context, namespace_rec.to_dict()): - msg = ("Forbidding request, metadata definition namespace=%s" - " is not visible." % name) - LOG.debug(msg) + LOG.debug("Forbidding request, metadata definition namespace=%s" + " is not visible.", name) emsg = _("Forbidding request, metadata definition namespace=%s" " is not visible.") % name raise exc.MetadefForbidden(emsg) @@ -229,9 +226,8 @@ def create(context, values, session): try: namespace.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("Can not create the metadata definition namespace." - " Namespace=%s already exists.") % namespace_name - LOG.debug(msg) + LOG.debug("Can not create the metadata definition namespace." + " Namespace=%s already exists.", namespace_name) raise exc.MetadefDuplicateNamespace( namespace_name=namespace_name) @@ -248,10 +244,9 @@ def update(context, namespace_id, values, session): namespace_rec.update(values.copy()) namespace_rec.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("Invalid update. It would result in a duplicate" - " metadata definition namespace with the same name of %s" - % values['namespace']) - LOG.debug(msg) + LOG.debug("Invalid update. It would result in a duplicate" + " metadata definition namespace with the same name of %s", + values['namespace']) emsg = (_("Invalid update. It would result in a duplicate" " metadata definition namespace with the same name of %s") % values['namespace']) @@ -269,9 +264,8 @@ def delete(context, name, session): session.flush() except db_exc.DBError as e: if isinstance(e.inner_exception, sa_exc.IntegrityError): - msg = ("Metadata definition namespace=%s not deleted." - " Other records still refer to it." % name) - LOG.debug(msg) + LOG.debug("Metadata definition namespace=%s not deleted. " + "Other records still refer to it.", name) raise exc.MetadefIntegrityError( record_type='namespace', record_name=name) else: @@ -298,9 +292,8 @@ def delete_cascade(context, name, session): session.flush() except db_exc.DBError as e: if isinstance(e.inner_exception, sa_exc.IntegrityError): - msg = ("Metadata definition namespace=%s not deleted." - " Other records still refer to it." % name) - LOG.debug(msg) + LOG.debug("Metadata definition namespace=%s not deleted. " + "Other records still refer to it.", name) raise exc.MetadefIntegrityError( record_type='namespace', record_name=name) else: diff --git a/glance/db/sqlalchemy/metadef_api/object.py b/glance/db/sqlalchemy/metadef_api/object.py index 92aea8e147..6625e6f081 100644 --- a/glance/db/sqlalchemy/metadef_api/object.py +++ b/glance/db/sqlalchemy/metadef_api/object.py @@ -48,10 +48,9 @@ def _get_by_name(context, namespace_name, name, session): name=name, namespace_id=namespace['id']) metadef_object = query.one() except sa_orm.exc.NoResultFound: - msg = ("The metadata definition object with name=%(name)s" - " was not found in namespace=%(namespace_name)s." - % {'name': name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("The metadata definition object with name=%(name)s" + " was not found in namespace=%(namespace_name)s.", + {'name': name, 'namespace_name': namespace_name}) raise exc.MetadefObjectNotFound(object_name=name, namespace_name=namespace_name) @@ -80,11 +79,10 @@ def create(context, namespace_name, values, session): try: md_object.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("A metadata definition object with name=%(name)s" - " in namespace=%(namespace_name)s already exists." - % {'name': md_object.name, - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("A metadata definition object with name=%(name)s" + " in namespace=%(namespace_name)s already exists.", + {'name': md_object.name, + 'namespace_name': namespace_name}) raise exc.MetadefDuplicateObject( object_name=md_object.name, namespace_name=namespace_name) @@ -108,11 +106,10 @@ def update(context, namespace_name, object_id, values, session): md_object.update(values.copy()) md_object.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("Invalid update. It would result in a duplicate" - " metadata definition object with same name=%(name)s" - " in namespace=%(namespace_name)s." - % {'name': md_object.name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("Invalid update. It would result in a duplicate" + " metadata definition object with same name=%(name)s" + " in namespace=%(namespace_name)s.", + {'name': md_object.name, 'namespace_name': namespace_name}) emsg = (_("Invalid update. It would result in a duplicate" " metadata definition object with the same name=%(name)s" " in namespace=%(namespace_name)s.") diff --git a/glance/db/sqlalchemy/metadef_api/property.py b/glance/db/sqlalchemy/metadef_api/property.py index 08e055c697..53d013668c 100644 --- a/glance/db/sqlalchemy/metadef_api/property.py +++ b/glance/db/sqlalchemy/metadef_api/property.py @@ -53,10 +53,9 @@ def _get_by_name(context, namespace_name, name, session): property_rec = query.one() except sa_orm.exc.NoResultFound: - msg = ("The metadata definition property with name=%(name)s" - " was not found in namespace=%(namespace_name)s." - % {'name': name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("The metadata definition property with name=%(name)s" + " was not found in namespace=%(namespace_name)s.", + {'name': name, 'namespace_name': namespace_name}) raise exc.MetadefPropertyNotFound(property_name=name, namespace_name=namespace_name) @@ -93,12 +92,11 @@ def create(context, namespace_name, values, session): try: property_rec.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("Can not create metadata definition property. A property" - " with name=%(name)s already exists in" - " namespace=%(namespace_name)s." - % {'name': property_rec.name, - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("Can not create metadata definition property. A property" + " with name=%(name)s already exists in" + " namespace=%(namespace_name)s.", + {'name': property_rec.name, + 'namespace_name': namespace_name}) raise exc.MetadefDuplicateProperty( property_name=property_rec.name, namespace_name=namespace_name) @@ -117,12 +115,11 @@ def update(context, namespace_name, property_id, values, session): property_rec.update(values.copy()) property_rec.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("Invalid update. It would result in a duplicate" - " metadata definition property with the same name=%(name)s" - " in namespace=%(namespace_name)s." - % {'name': property_rec.name, - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("Invalid update. It would result in a duplicate" + " metadata definition property with the same name=%(name)s" + " in namespace=%(namespace_name)s.", + {'name': property_rec.name, + 'namespace_name': namespace_name}) emsg = (_("Invalid update. It would result in a duplicate" " metadata definition property with the same name=%(name)s" " in namespace=%(namespace_name)s.") diff --git a/glance/db/sqlalchemy/metadef_api/resource_type.py b/glance/db/sqlalchemy/metadef_api/resource_type.py index 605afd680b..2ee19b612a 100644 --- a/glance/db/sqlalchemy/metadef_api/resource_type.py +++ b/glance/db/sqlalchemy/metadef_api/resource_type.py @@ -32,8 +32,8 @@ def get(context, name, session): query = session.query(models.MetadefResourceType).filter_by(name=name) resource_type = query.one() except sa_orm.exc.NoResultFound: - msg = "No metadata definition resource-type found with name %s" % name - LOG.debug(msg) + LOG.debug("No metadata definition resource-type found with name %s", + name) raise exc.MetadefResourceTypeNotFound(resource_type_name=name) return resource_type.to_dict() @@ -61,10 +61,9 @@ def create(context, values, session): try: resource_type.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("Can not create the metadata definition resource-type." - " A resource-type with name=%s already exists." - % resource_type.name) - LOG.debug(msg) + LOG.debug("Can not create the metadata definition resource-type. " + "A resource-type with name=%s already exists.", + resource_type.name) raise exc.MetadefDuplicateResourceType( resource_type_name=resource_type.name) @@ -88,9 +87,8 @@ def delete(context, name, session): db_rec = get(context, name, session) if db_rec.protected is True: - msg = ("Delete forbidden. Metadata definition resource-type %s is a" - " seeded-system type and can not be deleted.") % name - LOG.debug(msg) + LOG.debug("Delete forbidden. Metadata definition resource-type %s is a" + " seeded-system type and can not be deleted.", name) raise exc.ProtectedMetadefResourceTypeSystemDelete( resource_type_name=name) @@ -99,9 +97,8 @@ def delete(context, name, session): session.flush() except db_exc.DBError as e: if isinstance(e.inner_exception, sa_exc.IntegrityError): - msg = ("Could not delete Metadata definition resource-type %s" - ". It still has content") % name - LOG.debug(msg) + LOG.debug("Could not delete Metadata definition resource-type %s" + ". It still has content", name) raise exc.MetadefIntegrityError( record_type='resource-type', record_name=name) else: diff --git a/glance/db/sqlalchemy/metadef_api/resource_type_association.py b/glance/db/sqlalchemy/metadef_api/resource_type_association.py index 66cb23f8cf..420c9cd723 100644 --- a/glance/db/sqlalchemy/metadef_api/resource_type_association.py +++ b/glance/db/sqlalchemy/metadef_api/resource_type_association.py @@ -66,12 +66,11 @@ def _get(context, namespace_name, resource_type_name, namespace_id=namespace_id, resource_type_id=resource_type_id) db_rec = query.one() except sa_orm.exc.NoResultFound: - msg = ("The metadata definition resource-type association of" - " resource_type=%(resource_type_name)s to" - " namespace_name=%(namespace_name)s was not found." - % {'resource_type_name': resource_type_name, - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("The metadata definition resource-type association of" + " resource_type=%(resource_type_name)s to" + " namespace_name=%(namespace_name)s was not found.", + {'resource_type_name': resource_type_name, + 'namespace_name': namespace_name}) raise exc.MetadefResourceTypeAssociationNotFound( resource_type_name=resource_type_name, namespace_name=namespace_name) @@ -91,12 +90,11 @@ def _create_association( try: namespace_resource_type_rec.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("The metadata definition resource-type association of" - " resource_type=%(resource_type_name)s to" - " namespace=%(namespace_name)s, already exists." - % {'resource_type_name': resource_type_name, - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("The metadata definition resource-type association of" + " resource_type=%(resource_type_name)s to" + " namespace=%(namespace_name)s, already exists.", + {'resource_type_name': resource_type_name, + 'namespace_name': namespace_name}) raise exc.MetadefDuplicateResourceTypeAssociation( resource_type_name=resource_type_name, namespace_name=namespace_name) @@ -172,7 +170,7 @@ def create(context, namespace_name, values, session): context, resource_type_name, session) except exc.NotFound: resource_type = None - LOG.debug("Creating resource-type %s" % resource_type_name) + LOG.debug("Creating resource-type %s", resource_type_name) if resource_type is None: resource_type_dict = {'name': resource_type_name, 'protected': False} diff --git a/glance/db/sqlalchemy/metadef_api/tag.py b/glance/db/sqlalchemy/metadef_api/tag.py index 03ce025f56..1f76062546 100644 --- a/glance/db/sqlalchemy/metadef_api/tag.py +++ b/glance/db/sqlalchemy/metadef_api/tag.py @@ -47,10 +47,9 @@ def _get_by_name(context, namespace_name, name, session): name=name, namespace_id=namespace['id'])) metadef_tag = query.one() except sa_orm.exc.NoResultFound: - msg = ("The metadata tag with name=%(name)s" - " was not found in namespace=%(namespace_name)s." - % {'name': name, 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("The metadata tag with name=%(name)s" + " was not found in namespace=%(namespace_name)s.", + {'name': name, 'namespace_name': namespace_name}) raise exc.MetadefTagNotFound(name=name, namespace_name=namespace_name) return metadef_tag @@ -101,11 +100,10 @@ def create(context, namespace_name, values, session): try: metadef_tag.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("A metadata tag name=%(name)s" - " in namespace=%(namespace_name)s already exists." - % {'name': metadef_tag.name, - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("A metadata tag name=%(name)s" + " in namespace=%(namespace_name)s already exists.", + {'name': metadef_tag.name, + 'namespace_name': namespace_name}) raise exc.MetadefDuplicateTag( name=metadef_tag.name, namespace_name=namespace_name) @@ -133,11 +131,10 @@ def create_tags(context, namespace_name, tag_list, session): metadef_tag.save(session=session) metadef_tags_list.append(metadef_tag.to_dict()) except db_exc.DBDuplicateEntry: - msg = ("A metadata tag name=%(name)s" - " in namespace=%(namespace_name)s already exists." - % {'name': metadef_tag.name, - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("A metadata tag name=%(name)s" + " in namespace=%(namespace_name)s already exists.", + {'name': metadef_tag.name, + 'namespace_name': namespace_name}) raise exc.MetadefDuplicateTag( name=metadef_tag.name, namespace_name=namespace_name) @@ -160,12 +157,11 @@ def update(context, namespace_name, id, values, session): metadata_tag.update(values.copy()) metadata_tag.save(session=session) except db_exc.DBDuplicateEntry: - msg = ("Invalid update. It would result in a duplicate" - " metadata tag with same name=%(name)s" - " in namespace=%(namespace_name)s." - % {'name': values['name'], - 'namespace_name': namespace_name}) - LOG.debug(msg) + LOG.debug("Invalid update. It would result in a duplicate" + " metadata tag with same name=%(name)s" + " in namespace=%(namespace_name)s.", + {'name': values['name'], + 'namespace_name': namespace_name}) raise exc.MetadefDuplicateTag( name=values['name'], namespace_name=namespace_name) diff --git a/glance/domain/__init__.py b/glance/domain/__init__.py index 567c6fd046..5cc8321e2a 100644 --- a/glance/domain/__init__.py +++ b/glance/domain/__init__.py @@ -254,9 +254,8 @@ class Image(object): # Noop if already deactive pass else: - msg = ("Not allowed to deactivate image in status '%s'" - % self.status) - LOG.debug(msg) + LOG.debug("Not allowed to deactivate image in status '%s'", + self.status) msg = (_("Not allowed to deactivate image in status '%s'") % self.status) raise exception.Forbidden(message=msg) @@ -268,9 +267,8 @@ class Image(object): # Noop if already active pass else: - msg = ("Not allowed to reactivate image in status '%s'" - % self.status) - LOG.debug(msg) + LOG.debug("Not allowed to reactivate image in status '%s'", + self.status) msg = (_("Not allowed to reactivate image in status '%s'") % self.status) raise exception.Forbidden(message=msg) @@ -507,7 +505,7 @@ class TaskExecutorFactory(object): executor_cls = ('glance.async.%s_executor.' 'TaskExecutor' % task_executor) - LOG.debug("Loading %s executor" % task_executor) + LOG.debug("Loading %s executor", task_executor) executor = importutils.import_class(executor_cls) return executor(context, self.task_repo, diff --git a/glance/image_cache/drivers/xattr.py b/glance/image_cache/drivers/xattr.py index 67a394a081..2089aa1e4d 100644 --- a/glance/image_cache/drivers/xattr.py +++ b/glance/image_cache/drivers/xattr.py @@ -283,7 +283,7 @@ class Driver(base.Driver): # Make sure that we "pop" the image from the queue... if self.is_queued(image_id): LOG.debug("Removing image '%s' from queue after " - "caching it." % image_id) + "caching it.", image_id) os.unlink(self.get_image_filepath(image_id, 'queue')) def rollback(e): @@ -292,7 +292,7 @@ class Driver(base.Driver): invalid_path = self.get_image_filepath(image_id, 'invalid') LOG.debug("Fetch of cache file failed (%(e)s), rolling back by " "moving '%(incomplete_path)s' to " - "'%(invalid_path)s'" % + "'%(invalid_path)s'", {'e': encodeutils.exception_to_unicode(e), 'incomplete_path': incomplete_path, 'invalid_path': invalid_path}) @@ -437,7 +437,7 @@ def get_all_regular_files(basepath): def delete_cached_file(path): if os.path.exists(path): - LOG.debug("Deleting image cache file '%s'" % path) + LOG.debug("Deleting image cache file '%s'", path) os.unlink(path) else: LOG.warn(_LW("Cached image file '%s' doesn't exist, unable to" diff --git a/glance/registry/api/v1/images.py b/glance/registry/api/v1/images.py index 266cae0a20..bc0d7c4ede 100644 --- a/glance/registry/api/v1/images.py +++ b/glance/registry/api/v1/images.py @@ -341,8 +341,7 @@ class Controller(object): """Return data about the given image id.""" try: image = self.db_api.image_get(req.context, id) - msg = "Successfully retrieved image %(id)s" % {'id': id} - LOG.debug(msg) + LOG.debug("Successfully retrieved image %(id)s", {'id': id}) except exception.ImageNotFound: LOG.info(_LI("Image %(id)s not found"), {'id': id}) raise exc.HTTPNotFound() diff --git a/glance/registry/client/v1/client.py b/glance/registry/client/v1/client.py index f714c4b095..51ea156992 100644 --- a/glance/registry/client/v1/client.py +++ b/glance/registry/client/v1/client.py @@ -121,11 +121,10 @@ class RegistryClient(BaseClient): **kwargs) status = res.status request_id = res.getheader('x-openstack-request-id') - msg = ("Registry request %(method)s %(action)s HTTP %(status)s" - " request id %(request_id)s" % - {'method': method, 'action': action, - 'status': status, 'request_id': request_id}) - LOG.debug(msg) + LOG.debug("Registry request %(method)s %(action)s HTTP %(status)s" + " request id %(request_id)s", + {'method': method, 'action': action, + 'status': status, 'request_id': request_id}) except Exception as exc: with excutils.save_and_reraise_exception(): diff --git a/glance/scrubber.py b/glance/scrubber.py index d38e87c772..5125df186d 100644 --- a/glance/scrubber.py +++ b/glance/scrubber.py @@ -235,7 +235,7 @@ class Daemon(object): LOG.debug("Running application") self.daemon_pool.spawn_n(application.run, self.event) eventlet.spawn_after(self.wakeup_time, self._run, application) - LOG.debug("Next run scheduled in %s seconds" % self.wakeup_time) + LOG.debug("Next run scheduled in %s seconds", self.wakeup_time) class Scrubber(object): @@ -322,7 +322,7 @@ class Scrubber(object): if CONF.metadata_encryption_key: uri = crypt.urlsafe_decrypt(CONF.metadata_encryption_key, uri) try: - LOG.debug("Scrubbing image %s from a location." % image_id) + LOG.debug("Scrubbing image %s from a location.", image_id) try: self.store_api.delete_from_backend(uri, self.admin_context) except store_exceptions.NotFound: