From 6e4a992d31b67c457d56d28063a986152c70c842 Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Mon, 2 Feb 2015 09:08:17 -0800 Subject: [PATCH] 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 --- neutron/api/extensions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"), -- 2.45.2