From: Salvatore Orlando Date: Mon, 2 Feb 2015 17:08:17 +0000 (-0800) Subject: Discriminate loaded extensions using their alias X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6e4a992d31b67c457d56d28063a986152c70c842;p=openstack-build%2Fneutron-build.git Discriminate loaded extensions using their alias This patch simply changes the logic for discriminating which extensions have already been loaded using the extension alias rather than the module name. This will avoid failures already observed in unit tests occurring if two extension modules happen to have the same module file name even if they're unrelated. This change cannot be unit-tested as the neutron unit test framework is currently lacking a mechanism to mock and validate extension loading from the file system. Closes-Bug: #1417180 Change-Id: Ia214a7c5b1127dbbec3c81023fdbc48d7fadf18f --- diff --git a/neutron/api/extensions.py b/neutron/api/extensions.py index b1294e155..ea045b5ec 100644 --- a/neutron/api/extensions.py +++ b/neutron/api/extensions.py @@ -546,7 +546,6 @@ class ExtensionManager(object): mod_name) continue mod = imp.load_source(mod_name, ext_path) - loaded.append(mod_name) ext_name = mod_name[0].upper() + mod_name[1:] new_ext_class = getattr(mod, ext_name, None) if not new_ext_class: @@ -557,6 +556,7 @@ class ExtensionManager(object): continue new_ext = new_ext_class() self.add_extension(new_ext) + loaded.append(new_ext_class.get_alias()) except Exception as exception: LOG.warn(_LW("Extension file %(f)s wasn't loaded due to " "%(exception)s"),