diff options
author | Gábor Antal <antal@inf.u-szeged.hu> | 2017-02-15 16:22:43 +0100 |
---|---|---|
committer | Gábor Antal <antal@inf.u-szeged.hu> | 2017-06-06 16:03:27 +0200 |
commit | 219d8f9dc4af52dafaf38d769c70a3d7ebbc9022 (patch) | |
tree | b6e7882a8ae58a77cb5eac51140f710af2f837a4 /trove/module | |
parent | 3f159fe8444ef15846dff02813ae7fe86de6b853 (diff) | |
download | trove-219d8f9dc4af52dafaf38d769c70a3d7ebbc9022.tar.gz |
Handle log message interpolation by the logger part 10
The following directories were fixed in this commit:
- module/
- quota/
- taskmanager/
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: Iabfb6e8caeae3afe057b77315f26f9fdcaffda54
Related-Bug: #1642552
Diffstat (limited to 'trove/module')
-rw-r--r-- | trove/module/models.py | 21 | ||||
-rw-r--r-- | trove/module/service.py | 12 |
2 files changed, 18 insertions, 15 deletions
diff --git a/trove/module/models.py b/trove/module/models.py index 4091c92e..dc9138bb 100644 --- a/trove/module/models.py +++ b/trove/module/models.py @@ -68,7 +68,7 @@ class Modules(object): db_info = db_info.filter(or_(DBModule.tenant_id == context.tenant, DBModule.tenant_id.is_(None))) if db_info.count() == 0: - LOG.debug("No modules found for tenant %s" % context.tenant) + LOG.debug("No modules found for tenant %s", context.tenant) modules = db_info.all() return modules @@ -87,7 +87,7 @@ class Modules(object): db_info = Modules.add_datastore_filter(db_info, datastore_id) db_info = Modules.add_ds_version_filter(db_info, datastore_version_id) if db_info.count() == 0: - LOG.debug("No auto-apply modules found for tenant %s" % + LOG.debug("No auto-apply modules found for tenant %s", context.tenant) modules = db_info.all() return modules @@ -161,7 +161,7 @@ class Module(object): datastore_version, auto_apply, visible, live_update, priority_apply, apply_order, full_access): if module_type.lower() not in Modules.VALID_MODULE_TYPES: - LOG.error(_("Valid module types: %s") % Modules.VALID_MODULE_TYPES) + LOG.error(_("Valid module types: %s"), Modules.VALID_MODULE_TYPES) raise exception.ModuleTypeNotFound(module_type=module_type) Module.validate_action( context, 'create', tenant_id, auto_apply, visible, priority_apply, @@ -400,13 +400,16 @@ class InstanceModule(object): InstanceModule.update(context, instance_module) else: if old_im.md5 == md5 and instance_module: - LOG.debug("Found dupe IM record %s; marking as deleted " - "(instance %s, module %s)." % - (old_im.id, instance_id, module_id)) + LOG.debug("Found dupe IM record %(old_im)s; marking as " + "deleted (instance %(instance_id)s, " + "module %(module_id)s).", + {'old_im': old_im.id, 'instance_id': instance_id, + 'module_id': module_id}) else: - LOG.debug("Deleting IM record %s (instance %s, " - "module %s)." % - (old_im.id, instance_id, module_id)) + LOG.debug("Deleting IM record %(old_im)s (instance " + "%(instance_id)s, module %(module_id)s).", + {'old_im': old_im.id, 'instance_id': instance_id, + 'module_id': module_id}) InstanceModule.delete(context, old_im) # If we don't have an instance module, it means we need to create diff --git a/trove/module/service.py b/trove/module/service.py index ec2ee9b1..fab0a957 100644 --- a/trove/module/service.py +++ b/trove/module/service.py @@ -64,7 +64,7 @@ class ModuleController(wsgi.Controller): return wsgi.Result(view.data(), 200) def show(self, req, tenant_id, id): - LOG.info(_("Showing module %s.") % id) + LOG.info(_("Showing module %s."), id) context = req.environ[wsgi.CONTEXT_KEY] module = models.Module.load(context, id) @@ -78,7 +78,7 @@ class ModuleController(wsgi.Controller): def create(self, req, body, tenant_id): name = body['module']['name'] - LOG.info(_("Creating module '%s'") % name) + LOG.info(_("Creating module '%s'"), name) context = req.environ[wsgi.CONTEXT_KEY] policy.authorize_on_tenant(context, 'module:create') @@ -106,7 +106,7 @@ class ModuleController(wsgi.Controller): return wsgi.Result(view_data.data(), 200) def delete(self, req, tenant_id, id): - LOG.info(_("Deleting module %s.") % id) + LOG.info(_("Deleting module %s."), id) context = req.environ[wsgi.CONTEXT_KEY] module = models.Module.load(context, id) @@ -115,7 +115,7 @@ class ModuleController(wsgi.Controller): return wsgi.Result(None, 200) def update(self, req, body, tenant_id, id): - LOG.info(_("Updating module %s.") % id) + LOG.info(_("Updating module %s."), id) context = req.environ[wsgi.CONTEXT_KEY] module = models.Module.load(context, id) @@ -173,7 +173,7 @@ class ModuleController(wsgi.Controller): return wsgi.Result(view_data.data(), 200) def instances(self, req, tenant_id, id): - LOG.info(_("Getting instances for module %s.") % id) + LOG.info(_("Getting instances for module %s."), id) context = req.environ[wsgi.CONTEXT_KEY] @@ -206,7 +206,7 @@ class ModuleController(wsgi.Controller): return wsgi.Result(result_list, 200) def reapply(self, req, body, tenant_id, id): - LOG.info(_("Reapplying module %s to all instances.") % id) + LOG.info(_("Reapplying module %s to all instances."), id) context = req.environ[wsgi.CONTEXT_KEY] md5 = None |