groundwork icon indicating copy to clipboard operation
groundwork copied to clipboard

Plugin activation should throw an error if problems occur

Open djhellenico opened this issue 8 years ago • 2 comments

Current behaviour: If the configuration parameter 'LOAD_PLUGINS' contains a plugin which cannot be loaded, there is no error reported to the user. Especially in cases where the corresponding entry_point could not be loaded in advance.

Expected behaviour: If the configuration parameter 'LOAD_PLUGINS' contains a plugin name which cannot be loaded for any reason, groundwork should log a fatal error. The application should exit immediately. The behavious should be independendent of the the APP_STRICT setting.

djhellenico avatar Feb 06 '17 14:02 djhellenico

I agree, but APP_STRICT=False must not raise an error. If an applications uses e.g. 30 plugins and one unimportant plugin can not be loaded, that may be fine. The developer should be able to define the needed behavior. This means: APP_STRICT == True and missing plugin: Raise Exception and exit APP_STRICT == False and missing plugin: Log Error and load next plugin.

danwos avatar Feb 06 '17 15:02 danwos

The problem is that if the app configures a plugin to be loaded using self.app.plugins.activate and a plugin has a problem to load, then in pluginmanager.py we just have

            try:
                entry_point_object = entry_point.load()
            except Exception as e:
                # We should not throw an exception now, because a package/entry_point can be outdated, using an old
                # api from groundwork, tries to import unavailable packages, what ever...
                # We just do not make it available. That's all we can do.
                self._log.debug("Couldn't load entry_point %s. Reason: %s" % (entry_point.name, e))
                continue

A debug message for a plugin that is configured to be loaded is not enough. An exception is needed here in case app_strict==True. Currently app_strict is not considered.

ubmarco avatar Mar 22 '19 12:03 ubmarco