diff options
Diffstat (limited to 'kvmd/apps/__init__.py')
-rw-r--r-- | kvmd/apps/__init__.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index a4babdbf..4afd6b3a 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -52,6 +52,8 @@ from ..yamlconf import build_raw_from_options from ..yamlconf.dumper import make_config_dump from ..yamlconf.loader import load_yaml_file +from ..validators import check_string_in_list + from ..validators.basic import valid_stripped_string from ..validators.basic import valid_stripped_string_not_empty from ..validators.basic import valid_bool @@ -179,6 +181,7 @@ def _patch_dynamic( # pylint: disable=too-many-locals rebuild = True if load_gpio: + drivers: List[str] = [] for (driver, params) in { # type: ignore "__gpio__": {}, **tools.rget(raw_config, "kvmd", "gpio", "drivers"), @@ -189,12 +192,17 @@ def _patch_dynamic( # pylint: disable=too-many-locals "type": Option(driver_type, type=valid_stripped_string_not_empty), **get_ugpio_driver_class(driver_type).get_plugin_options() } + drivers.append(driver) for (channel, params) in tools.rget(raw_config, "kvmd", "gpio", "scheme").items(): channel = valid_ugpio_channel(channel) mode = valid_ugpio_mode(params.get("mode", "")) scheme["kvmd"]["gpio"]["scheme"][channel] = { - "driver": Option("__gpio__"), + "driver": Option("__gpio__", type=(lambda arg: check_string_in_list( + arg=valid_stripped_string_not_empty(arg), + name="configured GPIO driver", + variants=drivers, + ))), "pin": Option(-1, type=valid_gpio_pin), "mode": Option("", type=valid_ugpio_mode), "inverted": Option(False, type=valid_bool), |