summaryrefslogtreecommitdiff
path: root/trove/extensions
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-06-07 00:22:00 +0000
committerGerrit Code Review <review@openstack.org>2017-06-07 00:22:00 +0000
commit7a3ccd4bebcb0fc4eeffa208531d8291d7202821 (patch)
treeda4cf48d2191db7fbcfb9789870c5a4e22c8772e /trove/extensions
parent2bf6c30055042c29be689cd9cd67446c7b390dd2 (diff)
parent861557cebd67609f6ec59d085e5213ae76652afb (diff)
downloadtrove-7a3ccd4bebcb0fc4eeffa208531d8291d7202821.tar.gz
Merge "Handle log message interpolation by the logger part 7"
Diffstat (limited to 'trove/extensions')
-rw-r--r--trove/extensions/account/models.py2
-rw-r--r--trove/extensions/account/service.py8
-rw-r--r--trove/extensions/common/models.py2
-rw-r--r--trove/extensions/common/service.py26
-rw-r--r--trove/extensions/mgmt/clusters/service.py12
-rw-r--r--trove/extensions/mgmt/configuration/service.py10
-rw-r--r--trove/extensions/mgmt/datastores/service.py8
-rw-r--r--trove/extensions/mgmt/host/instance/service.py6
-rw-r--r--trove/extensions/mgmt/host/models.py7
-rw-r--r--trove/extensions/mgmt/host/service.py10
-rw-r--r--trove/extensions/mgmt/instances/models.py12
-rw-r--r--trove/extensions/mgmt/instances/service.py27
-rw-r--r--trove/extensions/mgmt/quota/service.py6
-rw-r--r--trove/extensions/mgmt/upgrade/service.py2
-rw-r--r--trove/extensions/mgmt/volume/service.py4
-rw-r--r--trove/extensions/mysql/service.py30
-rw-r--r--trove/extensions/security_group/models.py4
-rw-r--r--trove/extensions/security_group/service.py14
18 files changed, 95 insertions, 95 deletions
diff --git a/trove/extensions/account/models.py b/trove/extensions/account/models.py
index 55eb614e..ed29757f 100644
--- a/trove/extensions/account/models.py
+++ b/trove/extensions/account/models.py
@@ -50,7 +50,7 @@ class AccountsSummary(object):
db_infos = DBInstance.find_all(deleted=False)
tenant_ids_for_instances = [db_info.tenant_id for db_info in db_infos]
tenant_ids = set(tenant_ids_for_instances)
- LOG.debug("All tenants with instances: %s" % tenant_ids)
+ LOG.debug("All tenants with instances: %s", tenant_ids)
accounts = []
for tenant_id in tenant_ids:
num_instances = tenant_ids_for_instances.count(tenant_id)
diff --git a/trove/extensions/account/service.py b/trove/extensions/account/service.py
index 0d538ea7..025c53cc 100644
--- a/trove/extensions/account/service.py
+++ b/trove/extensions/account/service.py
@@ -32,9 +32,9 @@ class AccountController(wsgi.Controller):
@admin_context
def show(self, req, tenant_id, id):
"""Return a account and instances associated with a single account."""
- LOG.info(_("req : '%s'\n\n") % req)
+ LOG.info(_("req : '%s'\n\n"), req)
LOG.info(_("Showing account information for '%(account)s' "
- "to '%(tenant)s'") % {'account': id, 'tenant': tenant_id})
+ "to '%(tenant)s'"), {'account': id, 'tenant': tenant_id})
context = req.environ[wsgi.CONTEXT_KEY]
account = models.Account.load(context, id)
@@ -43,7 +43,7 @@ class AccountController(wsgi.Controller):
@admin_context
def index(self, req, tenant_id):
"""Return a list of all accounts with non-deleted instances."""
- LOG.info(_("req : '%s'\n\n") % req)
- LOG.info(_("Showing all accounts with instances for '%s'") % tenant_id)
+ LOG.info(_("req : '%s'\n\n"), req)
+ LOG.info(_("Showing all accounts with instances for '%s'"), tenant_id)
accounts_summary = models.AccountsSummary.load()
return wsgi.Result(views.AccountsView(accounts_summary).data(), 200)
diff --git a/trove/extensions/common/models.py b/trove/extensions/common/models.py
index 71b96f26..4102a425 100644
--- a/trove/extensions/common/models.py
+++ b/trove/extensions/common/models.py
@@ -109,7 +109,7 @@ class RootHistory(object):
self.created = utils.utcnow()
def save(self):
- LOG.debug("Saving %(name)s: %(dict)s" %
+ LOG.debug("Saving %(name)s: %(dict)s",
{'name': self.__class__.__name__, 'dict': self.__dict__})
return get_db_api().save(self)
diff --git a/trove/extensions/common/service.py b/trove/extensions/common/service.py
index 9c702ff4..b49282a9 100644
--- a/trove/extensions/common/service.py
+++ b/trove/extensions/common/service.py
@@ -93,8 +93,8 @@ class DefaultRootController(BaseDatastoreRootController):
if is_cluster:
raise exception.ClusterOperationNotSupported(
operation='show_root')
- LOG.info(_LI("Getting root enabled for instance '%s'.") % instance_id)
- LOG.info(_LI("req : '%s'\n\n") % req)
+ LOG.info(_LI("Getting root enabled for instance '%s'."), instance_id)
+ LOG.info(_LI("req : '%s'\n\n"), req)
context = req.environ[wsgi.CONTEXT_KEY]
is_root_enabled = models.Root.load(context, instance_id)
return wsgi.Result(views.RootEnabledView(is_root_enabled).data(), 200)
@@ -103,8 +103,8 @@ class DefaultRootController(BaseDatastoreRootController):
if is_cluster:
raise exception.ClusterOperationNotSupported(
operation='enable_root')
- LOG.info(_LI("Enabling root for instance '%s'.") % instance_id)
- LOG.info(_LI("req : '%s'\n\n") % req)
+ LOG.info(_LI("Enabling root for instance '%s'."), instance_id)
+ LOG.info(_LI("req : '%s'\n\n"), req)
context = req.environ[wsgi.CONTEXT_KEY]
user_name = context.user
password = DefaultRootController._get_password_from_body(body)
@@ -116,8 +116,8 @@ class DefaultRootController(BaseDatastoreRootController):
if is_cluster:
raise exception.ClusterOperationNotSupported(
operation='disable_root')
- LOG.info(_LI("Disabling root for instance '%s'.") % instance_id)
- LOG.info(_LI("req : '%s'\n\n") % req)
+ LOG.info(_LI("Disabling root for instance '%s'."), instance_id)
+ LOG.info(_LI("req : '%s'\n\n"), req)
context = req.environ[wsgi.CONTEXT_KEY]
try:
found_user = self._find_root_user(context, instance_id)
@@ -139,8 +139,8 @@ class ClusterRootController(DefaultRootController):
return self.instance_root_index(req, tenant_id, instance_id)
def instance_root_index(self, req, tenant_id, instance_id):
- LOG.info(_LI("Getting root enabled for instance '%s'.") % instance_id)
- LOG.info(_LI("req : '%s'\n\n") % req)
+ LOG.info(_LI("Getting root enabled for instance '%s'."), instance_id)
+ LOG.info(_LI("req : '%s'\n\n"), req)
context = req.environ[wsgi.CONTEXT_KEY]
try:
is_root_enabled = models.ClusterRoot.load(context, instance_id)
@@ -150,7 +150,7 @@ class ClusterRootController(DefaultRootController):
return wsgi.Result(views.RootEnabledView(is_root_enabled).data(), 200)
def cluster_root_index(self, req, tenant_id, cluster_id):
- LOG.info(_LI("Getting root enabled for cluster '%s'.") % cluster_id)
+ LOG.info(_LI("Getting root enabled for cluster '%s'."), cluster_id)
single_instance_id, cluster_instances = self._get_cluster_instance_id(
tenant_id, cluster_id)
return self.instance_root_index(req, tenant_id, single_instance_id)
@@ -173,8 +173,8 @@ class ClusterRootController(DefaultRootController):
def instance_root_create(self, req, body, instance_id,
cluster_instances=None):
- LOG.info(_LI("Enabling root for instance '%s'.") % instance_id)
- LOG.info(_LI("req : '%s'\n\n") % req)
+ LOG.info(_LI("Enabling root for instance '%s'."), instance_id)
+ LOG.info(_LI("req : '%s'\n\n"), req)
context = req.environ[wsgi.CONTEXT_KEY]
user_name = context.user
password = ClusterRootController._get_password_from_body(body)
@@ -183,7 +183,7 @@ class ClusterRootController(DefaultRootController):
return wsgi.Result(views.RootCreatedView(root).data(), 200)
def cluster_root_create(self, req, body, tenant_id, cluster_id):
- LOG.info(_LI("Enabling root for cluster '%s'.") % cluster_id)
+ LOG.info(_LI("Enabling root for cluster '%s'."), cluster_id)
single_instance_id, cluster_instances = self._get_cluster_instance_id(
tenant_id, cluster_id)
return self.instance_root_create(req, body, single_instance_id,
@@ -263,7 +263,7 @@ class RootController(ExtensionController):
def load_root_controller(self, manager):
try:
clazz = CONF.get(manager).get('root_controller')
- LOG.debug("Loading Root Controller class %s." % clazz)
+ LOG.debug("Loading Root Controller class %s.", clazz)
root_controller = import_class(clazz)
return root_controller()
except NoSuchOptError:
diff --git a/trove/extensions/mgmt/clusters/service.py b/trove/extensions/mgmt/clusters/service.py
index 74da071b..a955eeef 100644
--- a/trove/extensions/mgmt/clusters/service.py
+++ b/trove/extensions/mgmt/clusters/service.py
@@ -40,8 +40,8 @@ class MgmtClusterController(ClusterController):
@admin_context
def index(self, req, tenant_id):
"""Return a list of clusters."""
- LOG.debug("Showing a list of clusters for tenant '%s'." % tenant_id)
- LOG.info(_("req : '%s'\n\n") % req)
+ LOG.debug("Showing a list of clusters for tenant '%s'.", tenant_id)
+ LOG.info(_("req : '%s'\n\n"), req)
context = req.environ[wsgi.CONTEXT_KEY]
deleted = None
deleted_q = req.GET.get('deleted', '').lower()
@@ -58,7 +58,7 @@ class MgmtClusterController(ClusterController):
"""Return a single cluster."""
LOG.info(_("Showing cluster for tenant '%(tenant_id)s'.\n"
"req : '%(req)s'\n"
- "id : '%(id)s'") % {
+ "id : '%(id)s'"), {
"tenant_id": tenant_id, "req": req, "id": id})
context = req.environ[wsgi.CONTEXT_KEY]
@@ -70,9 +70,9 @@ class MgmtClusterController(ClusterController):
@admin_context
def action(self, req, body, tenant_id, id):
LOG.debug("Committing an action against cluster %(cluster)s for "
- "tenant '%(tenant)s'." % {'cluster': id,
- 'tenant': tenant_id})
- LOG.info(_("req : '%s'\n\n") % req)
+ "tenant '%(tenant)s'.", {'cluster': id,
+ 'tenant': tenant_id})
+ LOG.info(_("req : '%s'\n\n"), req)
if not body:
raise exception.BadRequest(_("Invalid request body."))
context = req.environ[wsgi.CONTEXT_KEY]
diff --git a/trove/extensions/mgmt/configuration/service.py b/trove/extensions/mgmt/configuration/service.py
index f5e555a6..c4d84052 100644
--- a/trove/extensions/mgmt/configuration/service.py
+++ b/trove/extensions/mgmt/configuration/service.py
@@ -75,8 +75,8 @@ class ConfigurationsParameterController(wsgi.Controller):
def create(self, req, body, tenant_id, version_id):
"""Create configuration parameter for datastore version."""
LOG.info(_("Creating configuration parameter for datastore"))
- LOG.debug("req : '%s'\n\n" % req)
- LOG.debug("body : '%s'\n\n" % body)
+ LOG.debug("req : '%s'\n\n", req)
+ LOG.debug("body : '%s'\n\n", body)
if not body:
raise exception.BadRequest(_("Invalid request body."))
@@ -102,8 +102,8 @@ class ConfigurationsParameterController(wsgi.Controller):
def update(self, req, body, tenant_id, version_id, id):
"""Updating configuration parameter for datastore version."""
LOG.info(_("Updating configuration parameter for datastore"))
- LOG.debug("req : '%s'\n\n" % req)
- LOG.debug("body : '%s'\n\n" % body)
+ LOG.debug("req : '%s'\n\n", req)
+ LOG.debug("body : '%s'\n\n", body)
if not body:
raise exception.BadRequest(_("Invalid request body."))
@@ -127,7 +127,7 @@ class ConfigurationsParameterController(wsgi.Controller):
def delete(self, req, tenant_id, version_id, id):
"""Delete configuration parameter for datastore version."""
LOG.info(_("Deleting configuration parameter for datastore"))
- LOG.debug("req : '%s'\n\n" % req)
+ LOG.debug("req : '%s'\n\n", req)
ds_config_params = config_models.DatastoreConfigurationParameters
try:
ds_config_params.delete(version_id, id)
diff --git a/trove/extensions/mgmt/datastores/service.py b/trove/extensions/mgmt/datastores/service.py
index 8090cbb8..7154d596 100644
--- a/trove/extensions/mgmt/datastores/service.py
+++ b/trove/extensions/mgmt/datastores/service.py
@@ -49,7 +49,7 @@ class DatastoreVersionController(wsgi.Controller):
default = body['version']['default']
LOG.info(_("Tenant: '%(tenant)s' is adding the datastore "
- "version: '%(version)s' to datastore: '%(datastore)s'") %
+ "version: '%(version)s' to datastore: '%(datastore)s'"),
{'tenant': tenant_id, 'version': version_name,
'datastore': datastore_name})
@@ -63,7 +63,7 @@ class DatastoreVersionController(wsgi.Controller):
datastore = models.Datastore.load(datastore_name)
except exception.DatastoreNotFound:
# Create the datastore if datastore_name does not exists.
- LOG.info(_("Creating datastore %s") % datastore_name)
+ LOG.info(_("Creating datastore %s"), datastore_name)
datastore = models.DBDatastore()
datastore.id = utils.generate_uuid()
datastore.name = datastore_name
@@ -107,7 +107,7 @@ class DatastoreVersionController(wsgi.Controller):
datastore_version = models.DatastoreVersion.load_by_uuid(id)
LOG.info(_("Tenant: '%(tenant)s' is updating the datastore "
- "version: '%(version)s' for datastore: '%(datastore)s'") %
+ "version: '%(version)s' for datastore: '%(datastore)s'"),
{'tenant': tenant_id, 'version': datastore_version.name,
'datastore': datastore_version.datastore_name})
@@ -145,7 +145,7 @@ class DatastoreVersionController(wsgi.Controller):
datastore = models.Datastore.load(datastore_version.datastore_id)
LOG.info(_("Tenant: '%(tenant)s' is removing the datastore "
- "version: '%(version)s' for datastore: '%(datastore)s'") %
+ "version: '%(version)s' for datastore: '%(datastore)s'"),
{'tenant': tenant_id, 'version': datastore_version.name,
'datastore': datastore.name})
diff --git a/trove/extensions/mgmt/host/instance/service.py b/trove/extensions/mgmt/host/instance/service.py
index 90edc4e0..b923dc0b 100644
--- a/trove/extensions/mgmt/host/instance/service.py
+++ b/trove/extensions/mgmt/host/instance/service.py
@@ -30,8 +30,8 @@ class HostInstanceController(wsgi.Controller):
def action(self, req, body, tenant_id, host_id):
LOG.info(_("Committing an ACTION against host %(host_id)s for "
"tenant '%(tenant_id)s'\n"
- "req : '%(req)s'\n\n") % {"req": req, "host_id": host_id,
- "tenant_id": tenant_id})
+ "req : '%(req)s'\n\n"), {"req": req, "host_id": host_id,
+ "tenant_id": tenant_id})
if not body:
raise exception.BadRequest(_("Invalid request body."))
@@ -55,6 +55,6 @@ class HostInstanceController(wsgi.Controller):
raise exception.BadRequest(_("Invalid request body."))
def _action_update(self, context, host, body):
- LOG.debug("Updating all instances for host: %s" % host.name)
+ LOG.debug("Updating all instances for host: %s", host.name)
host.update_all(context)
return wsgi.Result(None, 202)
diff --git a/trove/extensions/mgmt/host/models.py b/trove/extensions/mgmt/host/models.py
index c4c2861d..8778c5ac 100644
--- a/trove/extensions/mgmt/host/models.py
+++ b/trove/extensions/mgmt/host/models.py
@@ -73,12 +73,13 @@ class DetailedHost(object):
except exception.TroveError as re:
LOG.error(re)
LOG.error(_("Compute Instance ID found with no associated RD "
- "instance: %s.") % instance['server_id'])
+ "instance: %s."), instance['server_id'])
instance['id'] = None
def update_all(self, context):
num_i = len(self.instances)
- LOG.debug("Host %s has %s instances to update." % (self.name, num_i))
+ LOG.debug("Host %(name)s has %(num)s instances to update.",
+ {'name': self.name, 'num': num_i})
failed_instances = []
for instance in self.instances:
client = create_guest_client(context, instance['id'])
@@ -86,7 +87,7 @@ class DetailedHost(object):
client.update_guest()
except exception.TroveError as re:
LOG.error(re)
- LOG.error(_("Unable to update instance: %s.") % instance['id'])
+ LOG.error(_("Unable to update instance: %s."), instance['id'])
failed_instances.append(instance['id'])
if len(failed_instances) > 0:
msg = _("Failed to update instances: %s.") % failed_instances
diff --git a/trove/extensions/mgmt/host/service.py b/trove/extensions/mgmt/host/service.py
index aa29212e..15b21278 100644
--- a/trove/extensions/mgmt/host/service.py
+++ b/trove/extensions/mgmt/host/service.py
@@ -31,8 +31,8 @@ class HostController(InstanceController):
@admin_context
def index(self, req, tenant_id, detailed=False):
"""Return all hosts."""
- LOG.info(_("req : '%s'\n\n") % req)
- LOG.info(_("Indexing a host for tenant '%s'") % tenant_id)
+ LOG.info(_("req : '%s'\n\n"), req)
+ LOG.info(_("Indexing a host for tenant '%s'"), tenant_id)
context = req.environ[wsgi.CONTEXT_KEY]
hosts = models.SimpleHost.load_all(context)
return wsgi.Result(views.HostsView(hosts).data(), 200)
@@ -40,9 +40,9 @@ class HostController(InstanceController):
@admin_context
def show(self, req, tenant_id, id):
"""Return a single host."""
- LOG.info(_("req : '%s'\n\n") % req)
- LOG.info(_("Showing a host for tenant '%s'") % tenant_id)
- LOG.info(_("id : '%s'\n\n") % id)
+ LOG.info(_("req : '%s'\n\n"), req)
+ LOG.info(_("Showing a host for tenant '%s'"), tenant_id)
+ LOG.info(_("id : '%s'\n\n"), id)
context = req.environ[wsgi.CONTEXT_KEY]
host = models.DetailedHost.load(context, id)
return wsgi.Result(views.HostDetailedView(host).data(), 200)
diff --git a/trove/extensions/mgmt/instances/models.py b/trove/extensions/mgmt/instances/models.py
index 28c21303..b2b6fb0d 100644
--- a/trove/extensions/mgmt/instances/models.py
+++ b/trove/extensions/mgmt/instances/models.py
@@ -36,7 +36,7 @@ def load_mgmt_instances(context, deleted=None, client=None,
mgmt_servers = client.rdservers.list()
except AttributeError:
mgmt_servers = client.servers.list(search_opts={'all_tenants': 1})
- LOG.info(_("Found %d servers in Nova") %
+ LOG.info(_("Found %d servers in Nova"),
len(mgmt_servers if mgmt_servers else []))
args = {}
if deleted is not None:
@@ -199,8 +199,8 @@ class NotificationTransformer(object):
datastore_manager_id = id_map[datastore_manager]
else:
datastore_manager_id = cfg.UNKNOWN_SERVICE_ID
- LOG.error(_("Datastore ID for Manager (%s) is not configured")
- % datastore_manager)
+ LOG.error(_("Datastore ID for Manager (%s) is not configured"),
+ datastore_manager)
return datastore_manager_id
def transform_instance(self, instance, audit_start, audit_end):
@@ -238,7 +238,7 @@ class NotificationTransformer(object):
# message for all such instances. These instance are too new
# and will get picked up the next round of notifications.
LOG.debug("InstanceServiceStatus not found for %s. "
- "Will wait to send notification." % db_info.id)
+ "Will wait to send notification.", db_info.id)
continue
instance = SimpleMgmtInstance(None, db_info, None, service_status)
message = self.transform_instance(instance, audit_start, audit_end)
@@ -255,10 +255,10 @@ class NovaNotificationTransformer(NotificationTransformer):
def _lookup_flavor(self, flavor_id):
if flavor_id in self._flavor_cache:
- LOG.debug("Flavor cache hit for %s" % flavor_id)
+ LOG.debug("Flavor cache hit for %s", flavor_id)
return self._flavor_cache[flavor_id]
# fetch flavor resource from nova
- LOG.info(_("Flavor cache miss for %s") % flavor_id)
+ LOG.info(_("Flavor cache miss for %s"), flavor_id)
flavor = self.nova_client.flavors.get(flavor_id)
self._flavor_cache[flavor_id] = flavor.name if flavor else 'unknown'
return self._flavor_cache[flavor_id]
diff --git a/trove/extensions/mgmt/instances/service.py b/trove/extensions/mgmt/instances/service.py
index a1bd8c07..9e3fae6e 100644
--- a/trove/extensions/mgmt/instances/service.py
+++ b/trove/extensions/mgmt/instances/service.py
@@ -50,7 +50,7 @@ class MgmtInstanceController(InstanceController):
def index(self, req, tenant_id, detailed=False):
"""Return all instances."""
LOG.info(_("Indexing a database instance for tenant '%(tenant_id)s'\n"
- "req : '%(req)s'\n\n") % {
+ "req : '%(req)s'\n\n"), {
"tenant_id": tenant_id, "req": req})
context = req.environ[wsgi.CONTEXT_KEY]
deleted = None
@@ -76,7 +76,7 @@ class MgmtInstanceController(InstanceController):
"""Return a single instance."""
LOG.info(_("Showing a database instance %(id)s for tenant "
"'%(tenant_id)s'\n"
- "req : '%(req)s'\n\n") % {
+ "req : '%(req)s'\n\n"), {
"tenant_id": tenant_id, "req": req, "id": id})
context = req.environ[wsgi.CONTEXT_KEY]
deleted_q = req.GET.get('deleted', '').lower()
@@ -96,7 +96,7 @@ class MgmtInstanceController(InstanceController):
def action(self, req, body, tenant_id, id):
LOG.info(_("Committing an ACTION against a database "
"instance %(id)s for tenant '%(tenant_id)s'\n"
- "req : '%(req)s'\n\n") % {
+ "req : '%(req)s'\n\n"), {
"tenant_id": tenant_id, "req": req, "id": id})
if not body:
raise exception.BadRequest(_("Invalid request body."))
@@ -125,18 +125,18 @@ class MgmtInstanceController(InstanceController):
raise exception.BadRequest(_("Invalid request body."))
def _action_stop(self, context, instance, req, body):
- LOG.debug("Stopping MySQL on instance %s." % instance.id)
+ LOG.debug("Stopping MySQL on instance %s.", instance.id)
instance.stop_db()
return wsgi.Result(None, 202)
def _action_reboot(self, context, instance, req, body):
- LOG.debug("Rebooting instance %s." % instance.id)
+ LOG.debug("Rebooting instance %s.", instance.id)
instance.reboot()
return wsgi.Result(None, 202)
def _action_migrate(self, context, instance, req, body):
- LOG.debug("Migrating instance %s." % instance.id)
- LOG.debug("body['migrate']= %s" % body['migrate'])
+ LOG.debug("Migrating instance %s.", instance.id)
+ LOG.debug("body['migrate']= %s", body['migrate'])
host = body['migrate'].get('host', None)
context.notification = notification.DBaaSInstanceMigrate(context,
@@ -146,11 +146,10 @@ class MgmtInstanceController(InstanceController):
return wsgi.Result(None, 202)
def _action_reset_task_status(self, context, instance, req, body):
- LOG.debug("Setting Task-Status to NONE on instance %s." %
- instance.id)
+ LOG.debug("Setting Task-Status to NONE on instance %s.", instance.id)
instance.reset_task_status()
- LOG.debug("Failing backups for instance %s." % instance.id)
+ LOG.debug("Failing backups for instance %s.", instance.id)
Backup.fail_for_instance(instance.id)
return wsgi.Result(None, 202)
@@ -162,7 +161,7 @@ class MgmtInstanceController(InstanceController):
"""
LOG.info(_("Showing root history for a database "
"instance %(id)s for tenant '%(tenant_id)s'\n"
- "req : '%(req)s'\n\n") % {
+ "req : '%(req)s'\n\n"), {
"tenant_id": tenant_id, "req": req, "id": id})
context = req.environ[wsgi.CONTEXT_KEY]
@@ -183,7 +182,7 @@ class MgmtInstanceController(InstanceController):
"""Return a single instance hardware info."""
LOG.info(_("Showing hardware info for a database "
"instance %(id)s for tenant '%(tenant_id)s'\n"
- "req : '%(req)s'\n\n") % {
+ "req : '%(req)s'\n\n"), {
"tenant_id": tenant_id, "req": req, "id": id})
context = req.environ[wsgi.CONTEXT_KEY]
@@ -197,7 +196,7 @@ class MgmtInstanceController(InstanceController):
"""Return instance diagnostics for a single instance."""
LOG.info(_("Showing diagnostic info for a database "
"instance %(id)s for tenant '%(tenant_id)s'\n"
- "req : '%(req)s'\n\n") % {
+ "req : '%(req)s'\n\n"), {
"tenant_id": tenant_id, "req": req, "id": id})
context = req.environ[wsgi.CONTEXT_KEY]
@@ -211,7 +210,7 @@ class MgmtInstanceController(InstanceController):
"""Checks if instance is reachable via rpc."""
LOG.info(_("Sending RPC PING for a database "
"instance %(id)s for tenant '%(tenant_id)s'\n"
- "req : '%(req)s'\n\n") % {
+ "req : '%(req)s'\n\n"), {
"tenant_id": tenant_id, "req": req, "id": id})
context = req.environ[wsgi.CONTEXT_KEY]
diff --git a/trove/extensions/mgmt/quota/service.py b/trove/extensions/mgmt/quota/service.py
index 8c0c8ff2..1786160c 100644
--- a/trove/extensions/mgmt/quota/service.py
+++ b/trove/extensions/mgmt/quota/service.py
@@ -33,8 +33,7 @@ class QuotaController(wsgi.Controller):
def show(self, req, tenant_id, id):
"""Return all quotas for this tenant."""
LOG.info(_("Indexing quota info for tenant '%(id)s'\n"
- "req : '%(req)s'\n\n") % {
- "id": id, "req": req})
+ "req : '%(req)s'\n\n"), {"id": id, "req": req})
usages = quota_engine.get_all_quota_usages_by_tenant(id)
limits = quota_engine.get_all_quotas_by_tenant(id)
@@ -45,8 +44,7 @@ class QuotaController(wsgi.Controller):
@admin_context
def update(self, req, body, tenant_id, id):
LOG.info(_("Updating quota limits for tenant '%(id)s'\n"
- "req : '%(req)s'\n\n") % {
- "id": id, "req": req})
+ "req : '%(req)s'\n\n"), {"id": id, "req": req})
if not body:
raise exception.BadRequest(_("Invalid request body."))
diff --git a/trove/extensions/mgmt/upgrade/service.py b/trove/extensions/mgmt/upgrade/service.py
index 75c5bbf4..d4eba194 100644
--- a/trove/extensions/mgmt/upgrade/service.py
+++ b/trove/extensions/mgmt/upgrade/service.py
@@ -34,7 +34,7 @@ class UpgradeController(wsgi.Controller):
@admin_context
def create(self, req, body, tenant_id, instance_id):
LOG.info(_("Sending upgrade notifications\nreq : '%(req)s'\n"
- "Admin tenant_id: %(tenant_id)s") %
+ "Admin tenant_id: %(tenant_id)s"),
{"tenant_id": tenant_id, "req": req})
context = req.environ.get(wsgi.CONTEXT_KEY)
diff --git a/trove/extensions/mgmt/volume/service.py b/trove/extensions/mgmt/volume/service.py
index 3f9b4733..2761e8e2 100644
--- a/trove/extensions/mgmt/volume/service.py
+++ b/trove/extensions/mgmt/volume/service.py
@@ -33,8 +33,8 @@ class StorageController(wsgi.Controller):
@admin_context
def index(self, req, tenant_id):
"""Return all storage devices."""
- LOG.info(_("req : '%s'\n\n") % req)
- LOG.info(_("Indexing storage info for tenant '%s'") % tenant_id)
+ LOG.info(_("req : '%s'\n\n"), req)
+ LOG.info(_("Indexing storage info for tenant '%s'"), tenant_id)
context = req.environ[wsgi.CONTEXT_KEY]
storages = models.StorageDevices.load(context, CONF.os_region_name)
return wsgi.Result(views.StoragesView(storages).data(), 200)
diff --git a/trove/extensions/mysql/service.py b/trove/extensions/mysql/service.py
index fb444ede..b5784a02 100644
--- a/trove/extensions/mysql/service.py
+++ b/trove/extensions/mysql/service.py
@@ -58,7 +58,7 @@ class UserController(ExtensionController):
def index(self, req, tenant_id, instance_id):
"""Return all users."""
LOG.info(_("Listing users for instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": req})
context = req.environ[wsgi.CONTEXT_KEY]
self.authorize_target_action(context, 'user:index', instance_id)
@@ -72,7 +72,7 @@ class UserController(ExtensionController):
"""Creates a set of users."""
LOG.info(_("Creating users for instance '%(id)s'\n"
"req : '%(req)s'\n\n"
- "body: '%(body)s'\n'n") %
+ "body: '%(body)s'\n'n"),
{"id": instance_id,
"req": strutils.mask_password(req),
"body": strutils.mask_password(body)})
@@ -94,7 +94,7 @@ class UserController(ExtensionController):
def delete(self, req, tenant_id, instance_id, id):
LOG.info(_("Delete instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": req})
context = req.environ[wsgi.CONTEXT_KEY]
self.authorize_target_action(context, 'user:delete', instance_id)
@@ -123,7 +123,7 @@ class UserController(ExtensionController):
def show(self, req, tenant_id, instance_id, id):
"""Return a single user."""
LOG.info(_("Showing a user for instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": req})
context = req.environ[wsgi.CONTEXT_KEY]
self.authorize_target_action(context, 'user:show', instance_id)
@@ -143,7 +143,7 @@ class UserController(ExtensionController):
def update(self, req, body, tenant_id, instance_id, id):
"""Change attributes for one user."""
LOG.info(_("Updating user attributes for instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": strutils.mask_password(req)})
context = req.environ[wsgi.CONTEXT_KEY]
self.authorize_target_action(context, 'user:update', instance_id)
@@ -174,7 +174,7 @@ class UserController(ExtensionController):
def update_all(self, req, body, tenant_id, instance_id):
"""Change the password of one or more users."""
LOG.info(_("Updating user password for instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": strutils.mask_password(req)})
context = req.environ[wsgi.CONTEXT_KEY]
self.authorize_target_action(context, 'user:update_all', instance_id)
@@ -235,7 +235,7 @@ class UserAccessController(ExtensionController):
def index(self, req, tenant_id, instance_id, user_id):
"""Show permissions for the given user."""
LOG.info(_("Showing user access for instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": req})
context = req.environ[wsgi.CONTEXT_KEY]
@@ -245,7 +245,7 @@ class UserAccessController(ExtensionController):
user_id = correct_id_with_req(user_id, req)
user = self._get_user(context, instance_id, user_id)
if not user:
- LOG.error(_("No such user: %(user)s ") % {'user': user})
+ LOG.error(_("No such user: %(user)s "), {'user': user})
raise exception.UserNotFound(uuid=user)
username, hostname = unquote_user_host(user_id)
access = models.User.access(context, instance_id, username, hostname)
@@ -255,7 +255,7 @@ class UserAccessController(ExtensionController):
def update(self, req, body, tenant_id, instance_id, user_id):
"""Grant access for a user to one or more databases."""
LOG.info(_("Granting user access for instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": req})
context = req.environ[wsgi.CONTEXT_KEY]
self.authorize_target_action(
@@ -265,7 +265,7 @@ class UserAccessController(ExtensionController):
user_id = correct_id_with_req(user_id, req)
user = self._get_user(context, instance_id, user_id)
if not user:
- LOG.error(_("No such user: %(user)s ") % {'user': user})
+ LOG.error(_("No such user: %(user)s "), {'user': user})
raise exception.UserNotFound(uuid=user)
username, hostname = unquote_user_host(user_id)
databases = [db['name'] for db in body['databases']]
@@ -278,7 +278,7 @@ class UserAccessController(ExtensionController):
def delete(self, req, tenant_id, instance_id, user_id, id):
"""Revoke access for a user."""
LOG.info(_("Revoking user access for instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": req})
context = req.environ[wsgi.CONTEXT_KEY]
self.authorize_target_action(
@@ -288,7 +288,7 @@ class UserAccessController(ExtensionController):
user_id = correct_id_with_req(user_id, req)
user = self._get_user(context, instance_id, user_id)
if not user:
- LOG.error(_("No such user: %(user)s ") % {'user': user})
+ LOG.error(_("No such user: %(user)s "), {'user': user})
raise exception.UserNotFound(uuid=user)
username, hostname = unquote_user_host(user_id)
access = models.User.access(context, instance_id, username, hostname)
@@ -308,7 +308,7 @@ class SchemaController(ExtensionController):
def index(self, req, tenant_id, instance_id):
"""Return all schemas."""
LOG.info(_("Listing schemas for instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": req})
context = req.environ[wsgi.CONTEXT_KEY]
@@ -324,7 +324,7 @@ class SchemaController(ExtensionController):
"""Creates a set of schemas."""
LOG.info(_("Creating schema for instance '%(id)s'\n"
"req : '%(req)s'\n\n"
- "body: '%(body)s'\n'n") %
+ "body: '%(body)s'\n'n"),
{"id": instance_id,
"req": req,
"body": body})
@@ -348,7 +348,7 @@ class SchemaController(ExtensionController):
def delete(self, req, tenant_id, instance_id, id):
LOG.info(_("Deleting schema for instance '%(id)s'\n"
- "req : '%(req)s'\n\n") %
+ "req : '%(req)s'\n\n"),
{"id": instance_id, "req": req})
context = req.environ[wsgi.CONTEXT_KEY]
self.authorize_target_action(
diff --git a/trove/extensions/security_group/models.py b/trove/extensions/security_group/models.py
index 892e8f65..575ec95b 100644
--- a/trove/extensions/security_group/models.py
+++ b/trove/extensions/security_group/models.py
@@ -129,8 +129,8 @@ class SecurityGroup(DatabaseModelBase):
except (exception.ModelNotFoundError,
exception.TroveError):
LOG.info(_('Security Group with id: %(id)s '
- 'already had been deleted')
- % {'id': instance_id})
+ 'already had been deleted'),
+ {'id': instance_id})
class SecurityGroupRule(DatabaseModelBase):
diff --git a/trove/extensions/security_group/service.py b/trove/extensions/security_group/service.py
index 5a8c8bb4..a79dce6d 100644
--- a/trove/extensions/security_group/service.py
+++ b/trove/extensions/security_group/service.py
@@ -35,7 +35,7 @@ class SecurityGroupController(wsgi.Controller):
def index(self, req, tenant_id):
"""Return all security groups tied to a particular tenant_id."""
- LOG.debug("Index() called with %s" % (tenant_id))
+ LOG.debug("Index() called with %s", tenant_id)
sec_groups = models.SecurityGroup().find_all(tenant_id=tenant_id,
deleted=False)
@@ -50,7 +50,8 @@ class SecurityGroupController(wsgi.Controller):
def show(self, req, tenant_id, id):
"""Return a single security group."""
- LOG.debug("Show() called with %s, %s" % (tenant_id, id))
+ LOG.debug("Show() called with %(tenant_id)s, %(id)s",
+ {'tenant_id': tenant_id, 'id': id})
sec_group = \
models.SecurityGroup.get_security_group_by_id_or_instance_id(
@@ -66,7 +67,8 @@ class SecurityGroupRuleController(wsgi.Controller):
"""Controller for security group rule functionality."""
def delete(self, req, tenant_id, id):
- LOG.debug("Delete Security Group Rule called %s, %s" % (tenant_id, id))
+ LOG.debug("Delete Security Group Rule called %(tenant_id)s, %(id)s",
+ {'tenant_id': tenant_id, 'id': id})
context = req.environ[wsgi.CONTEXT_KEY]
sec_group_rule = models.SecurityGroupRule.find_by(id=id, deleted=False)
@@ -74,7 +76,7 @@ class SecurityGroupRuleController(wsgi.Controller):
if sec_group is None:
LOG.error(_("Attempting to delete Group Rule that does not "
- "exist or does not belong to tenant %s") % tenant_id)
+ "exist or does not belong to tenant %s"), tenant_id)
raise exception.Forbidden("Unauthorized")
sec_group_rule.delete(context, CONF.os_region_name)
@@ -82,7 +84,7 @@ class SecurityGroupRuleController(wsgi.Controller):
return wsgi.Result(None, 204)
def create(self, req, body, tenant_id):
- LOG.debug("Creating a Security Group Rule for tenant '%s'" % tenant_id)
+ LOG.debug("Creating a Security Group Rule for tenant '%s'", tenant_id)
context = req.environ[wsgi.CONTEXT_KEY]
self._validate_create_body(body)
@@ -130,7 +132,7 @@ class SecurityGroupRuleController(wsgi.Controller):
body['security_group_rule']['cidr']
except KeyError as e:
LOG.error(_("Create Security Group Rules Required field(s) "
- "- %s") % e)
+ "- %s"), e)
raise exception.SecurityGroupRuleCreationError(
"Required element/key - %s was not specified" % e)