# HG changeset patch
# User Goffi <goffi@goffi.org>
# Date 1631092595 -7200
# Node ID 760f3ff0509246219e0864b9c71678bd930e9207
# Parent  4a89342476e986435fbc215671c4cbf1d0f8e3b9
core (main): check plugin modes and skip pluggin/log an error if value is invalid

diff -r 4a89342476e9 -r 760f3ff05092 sat/core/sat_main.py
--- 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: