diff options
author | Devaev Maxim <[email protected]> | 2020-09-09 03:26:15 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-09-09 03:26:15 +0300 |
commit | 9c78f4f631facc41df099e5b6b318d0b9e665adc (patch) | |
tree | 67494eb1b5e654fcbd9a4d1d54639b3f898b346b /kvmd/apps/__init__.py | |
parent | 081797b2536149b41ca513e64c20de8ee40f5b6e (diff) |
catch manual validation
Diffstat (limited to 'kvmd/apps/__init__.py')
-rw-r--r-- | kvmd/apps/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index b3197306..9c8f5c03 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -46,6 +46,7 @@ from ..plugins.msd import get_msd_class from ..plugins.ugpio import get_ugpio_driver_class from ..yamlconf import ConfigError +from ..yamlconf import manual_validated from ..yamlconf import make_config from ..yamlconf import Section from ..yamlconf import Option @@ -185,7 +186,8 @@ def _patch_dynamic( # pylint: disable=too-many-locals "__gpio__": {}, **tools.rget(raw_config, "kvmd", "gpio", "drivers"), }.items(): - driver = valid_ugpio_driver(driver) + with manual_validated(driver, "kvmd", "gpio", "drivers", "<key>"): + driver = valid_ugpio_driver(driver) driver_type = valid_stripped_string_not_empty(params.get("type", "gpio")) scheme["kvmd"]["gpio"]["drivers"][driver] = { "type": Option(driver_type, type=valid_stripped_string_not_empty), @@ -194,8 +196,10 @@ def _patch_dynamic( # pylint: disable=too-many-locals drivers.add(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", "")) + with manual_validated(channel, "kvmd", "gpio", "scheme", "<key>"): + channel = valid_ugpio_channel(channel) + with manual_validated(params.get("mode", ""), "kvmd", "gpio", "scheme", channel, "mode"): + mode = valid_ugpio_mode(params.get("mode", "")) scheme["kvmd"]["gpio"]["scheme"][channel] = { "driver": Option("__gpio__", type=(lambda arg: valid_ugpio_driver(arg, drivers))), "pin": Option(-1, type=valid_gpio_pin), |