From: Doug Wiegley Date: Thu, 5 Feb 2015 03:33:35 +0000 (-0600) Subject: Fix breakage in all service repo unit tests, due to duplicate imports of exts X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=0abf9011051187c16f4418ce27462a9e1be35f1f;p=openstack-build%2Fneutron-build.git Fix breakage in all service repo unit tests, due to duplicate imports of exts Duplicate imports of the same class + super() are not playing nicely together, and our unit test base classes cause some dups in the extension search path, breaking the service repos. This was not noticed earlier in the extension moving process, because the temporary move code had a crude mechanism to prevent the loading of same named extensions. Change-Id: I0fbb2dbc01c67bb47a79f630ad352d1d92b6bb91 Partially-Implements: blueprint services-split --- diff --git a/neutron/api/extensions.py b/neutron/api/extensions.py index dd0e71a8a..cf273ddca 100644 --- a/neutron/api/extensions.py +++ b/neutron/api/extensions.py @@ -15,6 +15,7 @@ # under the License. import abc +import collections import imp import itertools import os @@ -676,6 +677,15 @@ def get_extensions_path(): if cfg.CONF.api_extensions_path: paths.append(cfg.CONF.api_extensions_path) + # If the path has dups in it, from discovery + conf file, the duplicate + # import of the same module and super() do not play nicely, so weed + # out the duplicates, preserving search order. + + z = collections.OrderedDict() + for x in paths: + z[x] = 1 + paths = z.keys() + LOG.debug("get_extension_paths = %s", paths) path = ':'.join(paths)