]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix breakage in all service repo unit tests, due to duplicate imports of exts
authorDoug Wiegley <dougw@a10networks.com>
Thu, 5 Feb 2015 03:33:35 +0000 (21:33 -0600)
committerDoug Wiegley <dougw@a10networks.com>
Thu, 5 Feb 2015 03:33:35 +0000 (21:33 -0600)
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

neutron/api/extensions.py

index dd0e71a8a1368f3b52d7ca793266022b10512ba9..cf273ddcad3afb99164d6daee2697d9fd5d22633 100644 (file)
@@ -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)