diff options
author | Gábor Antal <antal@inf.u-szeged.hu> | 2017-02-14 18:54:43 +0100 |
---|---|---|
committer | Gábor Antal <antal@inf.u-szeged.hu> | 2017-02-28 16:08:05 +0100 |
commit | 7191530abb7a21542da56427ec638a3a1fa1b602 (patch) | |
tree | 319de321af05cf343d9820ea8b7e95a2555ebc3b /trove/configuration | |
parent | 3d3181f56fd3137883ef166f5a8b46dbf23118c1 (diff) | |
download | trove-7191530abb7a21542da56427ec638a3a1fa1b602.tar.gz |
Handle log message interpolation by the logger part 5
The following directories were checked in this commit:
- conductor/
- configuration/
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: Ib46b6a5c947e250ec549ed9be1b8a7862f528d52
Related-Bug: #1642552
Diffstat (limited to 'trove/configuration')
-rw-r--r-- | trove/configuration/models.py | 16 | ||||
-rw-r--r-- | trove/configuration/service.py | 29 |
2 files changed, 22 insertions, 23 deletions
diff --git a/trove/configuration/models.py b/trove/configuration/models.py index 6639cc88..3ca3c2bd 100644 --- a/trove/configuration/models.py +++ b/trove/configuration/models.py @@ -51,8 +51,8 @@ class Configurations(object): db_info = DBConfiguration.find_all(tenant_id=context.tenant, deleted=False) if db_info.count() == 0: - LOG.debug("No configurations found for tenant %s" - % context.tenant) + LOG.debug("No configurations found for tenant %s", + context.tenant) limit = utils.pagination_limit(context.limit, Configurations.DEFAULT_LIMIT) @@ -90,8 +90,8 @@ class Configuration(object): @staticmethod def create_items(cfg_id, values): - LOG.debug("Saving configuration values for %s - " - "values: %s" % (cfg_id, values)) + LOG.debug("Saving configuration values for %(id)s - " + "values: %(values)s", {'id': cfg_id, 'values': values}) config_items = [] for key, val in values.items(): config_item = DBConfigurationParameter.create( @@ -113,7 +113,7 @@ class Configuration(object): def remove_all_items(context, id, deleted_at): items = DBConfigurationParameter.find_all(configuration_id=id, deleted=False).all() - LOG.debug("Removing all configuration values for %s" % id) + LOG.debug("Removing all configuration values for %s", id) for item in items: item.deleted = True item.deleted_at = deleted_at @@ -187,15 +187,15 @@ class Configuration(object): self.configuration_id) config_items = Configuration.load_items(self.context, id=self.configuration_id) - LOG.debug("config_items: %s" % config_items) + LOG.debug("config_items: %s", config_items) detail_list = DatastoreConfigurationParameters.load_parameters( datastore_v.id, show_deleted=True) for i in config_items: - LOG.debug("config item: %s" % i) + LOG.debug("config item: %s", i) details = Configuration.find_parameter_details( i.configuration_key, detail_list) - LOG.debug("parameter details: %s" % details) + LOG.debug("parameter details: %s", details) if not details: raise exception.NotFound(uuid=i.configuration_key) if bool(details.restart_required): diff --git a/trove/configuration/service.py b/trove/configuration/service.py index e7668a88..5cf9ff8b 100644 --- a/trove/configuration/service.py +++ b/trove/configuration/service.py @@ -59,8 +59,8 @@ class ConfigurationsController(wsgi.Controller): return wsgi.Result(paged.data(), 200) def show(self, req, tenant_id, id): - LOG.debug("Showing configuration group %(id)s on tenant %(tenant)s" - % {"tenant": tenant_id, "id": id}) + LOG.debug("Showing configuration group %(id)s on tenant %(tenant)s", + {"tenant": tenant_id, "id": id}) context = req.environ[wsgi.CONTEXT_KEY] configuration = models.Configuration.load(context, id) self.authorize_config_action(context, 'show', configuration) @@ -96,8 +96,8 @@ class ConfigurationsController(wsgi.Controller): return wsgi.Result(paged.data(), 200) def create(self, req, body, tenant_id): - LOG.debug("req : '%s'\n\n" % req) - LOG.debug("body : '%s'\n\n" % req) + LOG.debug("req : '%s'\n\n", req) + LOG.debug("body : '%s'\n\n", req) context = req.environ[wsgi.CONTEXT_KEY] policy.authorize_on_tenant(context, 'configuration:create') @@ -109,7 +109,7 @@ class ConfigurationsController(wsgi.Controller): msg = _("Creating configuration group on tenant " "%(tenant_id)s with name: %(cfg_name)s") - LOG.info(msg % {"tenant_id": tenant_id, "cfg_name": name}) + LOG.info(msg, {"tenant_id": tenant_id, "cfg_name": name}) datastore_args = body['configuration'].get('datastore', {}) datastore, datastore_version = ( @@ -146,7 +146,7 @@ class ConfigurationsController(wsgi.Controller): def delete(self, req, tenant_id, id): msg = _("Deleting configuration group %(cfg_id)s on tenant: " "%(tenant_id)s") - LOG.info(msg % {"tenant_id": tenant_id, "cfg_id": id}) + LOG.info(msg, {"tenant_id": tenant_id, "cfg_id": id}) context = req.environ[wsgi.CONTEXT_KEY] group = models.Configuration.load(context, id) @@ -166,7 +166,7 @@ class ConfigurationsController(wsgi.Controller): def update(self, req, body, tenant_id, id): msg = _("Updating configuration group %(cfg_id)s for tenant " "id %(tenant_id)s") - LOG.info(msg % {"tenant_id": tenant_id, "cfg_id": id}) + LOG.info(msg, {"tenant_id": tenant_id, "cfg_id": id}) context = req.environ[wsgi.CONTEXT_KEY] group = models.Configuration.load(context, id) @@ -219,8 +219,8 @@ class ConfigurationsController(wsgi.Controller): def _refresh_on_all_instances(self, context, configuration_id): """Refresh a configuration group on all single instances. """ - LOG.debug("Re-applying configuration group '%s' to all instances." - % configuration_id) + LOG.debug("Re-applying configuration group '%s' to all instances.", + configuration_id) single_instances = instances_models.DBInstance.find_all( tenant_id=context.tenant, configuration_id=configuration_id, @@ -229,24 +229,23 @@ class ConfigurationsController(wsgi.Controller): config = models.Configuration(context, configuration_id) for dbinstance in single_instances: - LOG.debug("Re-applying configuration to instance: %s" - % dbinstance.id) + LOG.debug("Re-applying configuration to instance: %s", + dbinstance.id) instance = instances_models.Instance.load(context, dbinstance.id) instance.update_configuration(config) def _refresh_on_all_clusters(self, context, configuration_id): """Refresh a configuration group on all clusters. """ - LOG.debug("Re-applying configuration group '%s' to all clusters." - % configuration_id) + LOG.debug("Re-applying configuration group '%s' to all clusters.", + configuration_id) clusters = cluster_models.DBCluster.find_all( tenant_id=context.tenant, configuration_id=configuration_id, deleted=False).all() for dbcluster in clusters: - LOG.debug("Re-applying configuration to cluster: %s" - % dbcluster.id) + LOG.debug("Re-applying configuration to cluster: %s", dbcluster.id) cluster = cluster_models.Cluster.load(context, dbcluster.id) cluster.configuration_attach(configuration_id) |