From 74370e8c180861476bf0372d7e2d07ddbe60b5d2 Mon Sep 17 00:00:00 2001 From: zhufl Date: Wed, 17 Apr 2019 16:19:19 +0800 Subject: [PATCH] Pass kwargs to exception to get better format of error message If we do not pass kwargs to exception, the parameter will be deemed as message and will be displayed directly. This is to pass kwargs to some exceptions, to get better format of error message. Change-Id: Ia7d0ec0152de9ee4bdf10c8de80e8d32bbf4a42b --- trove/dns/designate/driver.py | 2 +- trove/guestagent/datastore/experimental/cassandra/service.py | 2 +- trove/guestagent/datastore/experimental/postgresql/service.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/trove/dns/designate/driver.py b/trove/dns/designate/driver.py index ddbac94a2d..c02e1cd568 100644 --- a/trove/dns/designate/driver.py +++ b/trove/dns/designate/driver.py @@ -104,7 +104,7 @@ class DesignateDriver(driver.DnsDriver): matching_record = [rec for rec in records if rec.name == name + '.' and rec.type == type] if not matching_record: - raise exception.DnsRecordNotFound(name) + raise exception.DnsRecordNotFound(name=name) LOG.debug("Deleting DNS entry %s.", name) self.dns_client.records.delete(dns_zone.id, matching_record[0].id) diff --git a/trove/guestagent/datastore/experimental/cassandra/service.py b/trove/guestagent/datastore/experimental/cassandra/service.py index 66a73c0713..721b46b690 100644 --- a/trove/guestagent/datastore/experimental/cassandra/service.py +++ b/trove/guestagent/datastore/experimental/cassandra/service.py @@ -1146,7 +1146,7 @@ class CassandraAdmin(object): if user: return user.databases - raise exception.UserNotFound(username) + raise exception.UserNotFound(uuid=username) def _deserialize_keyspace(self, keyspace_dict, check_reserved=True): if keyspace_dict: diff --git a/trove/guestagent/datastore/experimental/postgresql/service.py b/trove/guestagent/datastore/experimental/postgresql/service.py index a2017c4b2f..cf62b08c24 100644 --- a/trove/guestagent/datastore/experimental/postgresql/service.py +++ b/trove/guestagent/datastore/experimental/postgresql/service.py @@ -654,7 +654,7 @@ class PgSqlAdmin(object): if user is not None: return user.databases - raise exception.UserNotFound(username) + raise exception.UserNotFound(uuid=username) def create_database(self, context, databases): """Create the list of specified databases.