]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Fix issubclass() hook behavior in PluginInterface
authorRoman Podoliaka <rpodolyaka@mirantis.com>
Wed, 16 Apr 2014 10:59:33 +0000 (13:59 +0300)
committerRoman Podoliaka <rpodolyaka@mirantis.com>
Mon, 12 May 2014 18:59:12 +0000 (21:59 +0300)
commit237f05839668d8d26e81b02746086c651431988b
treeadd474a67faaaaeb34978d027437514d83f3318b
parent43561d4e6d0eb5d1b32db6880f2e19930d91a192
Fix issubclass() hook behavior in PluginInterface

Currently, PluginInterface provides an issubclass() hook that returns
True for issubclass(A, B) call, if all abstract methods of B (stored
in B.__abstractmethods__) can be found in the A.__mro__ tuple of
classes. But there is an edge case, when B doesn't have any abstract
methods, which leads to issubclass(A, B) call returning True even if
A and B are not related all.

E.g. issubclass(NeutronPluginPLUMgridV2, NsxPlugin) returns True,
while these two are different core plugins. And it gets even more
trickier when superclasses are involved: e.g. SecurityGroupDbMixin is
a superclass of NsxPlugin, so depending on the fact whether the
python module with NsxPlugin class is imported or not,
issubclass(NeutronPluginPLUMgridV2, SecurityGroupDbMixin) will return
either False or True accordingly.

Closes-Bug: #1308489

Change-Id: I92711a00a19b89729ccdba9cbd8a2e7a2d2868ed
neutron/api/extensions.py
neutron/tests/unit/test_extensions.py