summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorKevin L. Mitchell <kevin.mitchell@rackspace.com>2011-06-17 20:40:28 +0000
committerTarmac <>2011-06-17 20:40:28 +0000
commit2e6c26fcc8967192e35e0d2b2473bae578eb5b04 (patch)
tree53cdfbb99c59ceeca447b136cc441ac60a46ebc9 /nova/api
parent33434e33f8f2e8fd809554cefeb3293efb372141 (diff)
parentf0b0f4ad4c6f90b1b3b23e6a048ebda8e62cb254 (diff)
downloadnova-2e6c26fcc8967192e35e0d2b2473bae578eb5b04.tar.gz
nova-2e6c26fcc8967192e35e0d2b2473bae578eb5b04.tar.xz
nova-2e6c26fcc8967192e35e0d2b2473bae578eb5b04.zip
Fixes two minor bugs (lp795123 and lp795126) in the extension mechanism. The first bug is that each extension has _check_extension() called twice on it; this is a minor cosmetic problem, but the second is that extensions which flunk _check_extension() are still added. The proposed fix is to make _check_extensions() return True or False, then make _add_extension() call it from the top and return immediately if _check_extensions() returns False.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/extensions.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py
index 54e17e23d..da06ecd15 100644
--- a/nova/api/openstack/extensions.py
+++ b/nova/api/openstack/extensions.py
@@ -374,6 +374,8 @@ class ExtensionManager(object):
LOG.debug(_('Ext updated: %s'), extension.get_updated())
except AttributeError as ex:
LOG.exception(_("Exception loading extension: %s"), unicode(ex))
+ return False
+ return True
def _load_all_extensions(self):
"""Load extensions from the configured path.
@@ -412,15 +414,16 @@ class ExtensionManager(object):
'file': ext_path})
continue
new_ext = new_ext_class()
- self._check_extension(new_ext)
- self._add_extension(new_ext)
+ self.add_extension(new_ext)
+
+ def add_extension(self, ext):
+ # Do nothing if the extension doesn't check out
+ if not self._check_extension(ext):
+ return
- def _add_extension(self, ext):
alias = ext.get_alias()
LOG.audit(_('Loaded extension: %s'), alias)
- self._check_extension(ext)
-
if alias in self.extensions:
raise exception.Error("Found duplicate extension: %s" % alias)
self.extensions[alias] = ext