From 692938fbf6931d78ccb08adc18d22056e7bf5d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Antal?= Date: Tue, 14 Feb 2017 15:37:34 +0100 Subject: [PATCH] Handle log message interpolation by the logger in backup/ According to OpenStack Guideline[1], logged string message should be interpolated by the logger. [1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages Change-Id: Ia79addd292000dfd1e3ecb15884b8dccac4d9284 Related-Bug: #1642552 --- trove/backup/models.py | 4 ++-- trove/backup/service.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/trove/backup/models.py b/trove/backup/models.py index 49878f9c5a..c939846d7b 100644 --- a/trove/backup/models.py +++ b/trove/backup/models.py @@ -344,11 +344,11 @@ class DBBackup(DatabaseModelBase): obj = parts[-1] container = parts[-2] client = create_swift_client(context) - LOG.debug("Checking if backup exists in %s" % self.location) + LOG.debug("Checking if backup exists in %s", self.location) resp = client.head_object(container, obj) if verify_checksum: LOG.debug("Checking if backup checksum matches swift " - "for backup %s" % self.id) + "for backup %s", self.id) # swift returns etag in double quotes # e.g. '"dc3b0827f276d8d78312992cc60c2c3f"' swift_checksum = resp['etag'].strip('"') diff --git a/trove/backup/service.py b/trove/backup/service.py index bb14b6bb8d..f5ed6c77f8 100644 --- a/trove/backup/service.py +++ b/trove/backup/service.py @@ -38,7 +38,7 @@ class BackupController(wsgi.Controller): """ Return all backups information for a tenant ID. """ - LOG.debug("Listing backups for tenant %s" % tenant_id) + LOG.debug("Listing backups for tenant %s", tenant_id) datastore = req.GET.get('datastore') context = req.environ[wsgi.CONTEXT_KEY] policy.authorize_on_tenant(context, 'backup:index') @@ -50,8 +50,8 @@ class BackupController(wsgi.Controller): def show(self, req, tenant_id, id): """Return a single backup.""" - LOG.debug("Showing a backup for tenant %s ID: '%s'" - % (tenant_id, id)) + LOG.debug("Showing a backup for tenant %(tenant_id)s ID: '%(id)s'", + {'tenant_id': tenant_id, 'id': id}) context = req.environ[wsgi.CONTEXT_KEY] backup = Backup.get_by_id(context, id) policy.authorize_on_target(context, 'backup:show', @@ -78,7 +78,7 @@ class BackupController(wsgi.Controller): def delete(self, req, tenant_id, id): LOG.info(_('Deleting backup for tenant %(tenant_id)s ' - 'ID: %(backup_id)s') % + 'ID: %(backup_id)s'), {'tenant_id': tenant_id, 'backup_id': id}) context = req.environ[wsgi.CONTEXT_KEY] backup = Backup.get_by_id(context, id)