changeset 3650:760f3ff05092

core (main): check plugin modes and skip pluggin/log an error if value is invalid
author Goffi <goffi@goffi.org>
date Wed, 08 Sep 2021 11:16:35 +0200
parents 4a89342476e9
children 867a15f05476
files sat/core/sat_main.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/sat_main.py	Wed Sep 08 11:16:29 2021 +0200
+++ b/sat/core/sat_main.py	Wed Sep 08 11:16:35 2021 +0200
@@ -330,6 +330,12 @@
             plugin_modes = plugin_info["modes"] = set(
                 plugin_info.setdefault("modes", C.PLUG_MODE_DEFAULT)
             )
+            if not plugin_modes.intersection(C.PLUG_MODE_BOTH):
+                log.error(
+                    f"Can't import plugin at {plugin_path}, invalid {C.PI_MODES!r} "
+                    f"value: {plugin_modes!r}"
+                )
+                continue
 
             # if the plugin is an entry point, it must work in component mode
             if plugin_info["type"] == C.PLUG_TYPE_ENTRY_POINT: