1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-26 18:08:36 -05:00

Allow loading a specific list of plugins

Updated the PluginManager to allow only activating a
specific list of plugins passed in, instead of what is
in the config file.
This commit is contained in:
Hemna 2024-11-08 13:20:42 -05:00
parent 6e62ac14b8
commit 9f3c8f889f

View File

@ -472,7 +472,10 @@ class PluginManager:
del self._pluggy_pm
self.setup_plugins()
def setup_plugins(self, load_help_plugin=True):
def setup_plugins(
self, load_help_plugin=True,
plugin_list=[],
):
"""Create the plugin manager and register plugins."""
LOG.info("Loading APRSD Plugins")
@ -481,9 +484,13 @@ class PluginManager:
_help = HelpPlugin()
self._pluggy_pm.register(_help)
enabled_plugins = CONF.enabled_plugins
if enabled_plugins:
for p_name in enabled_plugins:
# if plugins_list is passed in, only load
# those plugins.
if plugin_list:
for plugin_name in plugin_list:
self._load_plugin(plugin_name)
elif CONF.enabled_plugins:
for p_name in CONF.enabled_plugins:
self._load_plugin(p_name)
else:
# Enabled plugins isn't set, so we default to loading all of