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
This commit is contained in:
Gábor Antal 2017-02-14 15:37:34 +01:00
parent 3d3181f56f
commit 692938fbf6
2 changed files with 6 additions and 6 deletions

View File

@ -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('"')

View File

@ -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)