]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/plugins/__init__.py
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / pybind / mgr / dashboard / plugins / __init__.py
index d3c54ce6c2b1e5fb4c04c7e68b7304ccf669d631..43d71fdedb722b482ffe5ff940669112a6c2a106 100644 (file)
@@ -12,6 +12,10 @@ class Interface(object):
     pass
 
 
+class Mixin(object):
+    pass
+
+
 class DashboardPluginManager(object):
     def __init__(self, project_name):
         self.__pm = PluginManager(project_name)
@@ -32,6 +36,11 @@ class DashboardPluginManager(object):
         self.pm.add_hookspecs(cls)
         return cls
 
+    @staticmethod
+    def final(func):
+        setattr(func, '__final__', True)
+        return func
+
     def add_plugin(self, plugin):
         """ Provides decorator interface for PluginManager.register():
             @PLUGIN_MANAGER.add_plugin
@@ -45,6 +54,9 @@ class DashboardPluginManager(object):
         from inspect import getmembers, ismethod
         for interface in plugin.__bases__:
             for method_name, _ in getmembers(interface, predicate=ismethod):
+                if hasattr(getattr(interface, method_name), '__final__'):
+                    continue
+
                 if self.pm.parse_hookimpl_opts(plugin, method_name) is None:
                     raise NotImplementedError(
                         "Plugin '{}' implements interface '{}' but existing"