From 3d1faebf15da676c323b0c3681a623ebcca283d4 Mon Sep 17 00:00:00 2001 From: Arksine Date: Sat, 26 Sep 2020 06:09:08 -0400 Subject: [PATCH] moonraker: load_plugin() fix Make sure that the correct config section is loaded when "load_plugin" is called. Signed-off-by: Eric Callahan --- moonraker/moonraker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/moonraker/moonraker.py b/moonraker/moonraker.py index 06dc1eb..5ae45b8 100644 --- a/moonraker/moonraker.py +++ b/moonraker/moonraker.py @@ -99,7 +99,7 @@ class Server: opt_sections = set(config.sections()) - \ set(['server', 'authorization', 'cmd_args']) for section in opt_sections: - self.load_plugin(config[section], section, None) + self.load_plugin(config, section, None) def load_plugin(self, config, plugin_name, default=Sentinel): if plugin_name in self.plugins: @@ -115,11 +115,13 @@ class Server: return default module = importlib.import_module("plugins." + plugin_name) try: + if plugin_name not in CORE_PLUGINS: + config = config[plugin_name] load_func = getattr(module, "load_plugin") plugin = load_func(config) except Exception: msg = f"Unable to load plugin ({plugin_name})" - logging.info(msg) + logging.exception(msg) if default == Sentinel: raise ServerError(msg) return default