From e39a61b605ea5dd5a9a64e95c5e7bb8759ff30e2 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Sat, 27 Aug 2016 07:32:46 +0000 Subject: [PATCH] objects: use correct object class name in NeutronPrimaryKeyMissing We were passing cls.__class__ as the object type into the exception error message. But in case of DeclarativeObject based classes (all NeutronDbObject classes), the result of it is a message like: neutron.objects.base.NeutronPrimaryKeyMissing: For class DeclarativeObject missing primary keys: set([]) Note the class name is DeclarativeObject, not the intented object class name. Change-Id: I005512b4edf6e4c68a803f4180983e4a01e4f036 --- neutron/objects/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/objects/base.py b/neutron/objects/base.py index 667c59d7759..27f3ea68e67 100644 --- a/neutron/objects/base.py +++ b/neutron/objects/base.py @@ -387,7 +387,7 @@ class NeutronDbObject(NeutronObject): all_keys = itertools.chain([cls.primary_keys], cls.unique_keys) if not any(lookup_keys.issuperset(keys) for keys in all_keys): missing_keys = set(cls.primary_keys).difference(lookup_keys) - raise NeutronPrimaryKeyMissing(object_class=cls.__class__, + raise NeutronPrimaryKeyMissing(object_class=cls.__name__, missing_keys=missing_keys) with db_api.autonested_transaction(context.session):