diff options
author | Devaev Maxim <[email protected]> | 2019-10-24 03:09:06 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-10-24 03:09:06 +0300 |
commit | b4ef91838e16cdb70ae1152c320a3973f07c5f89 (patch) | |
tree | a98b222952940dedb07cdb1ebe89025af3c50e46 /kvmd/apps | |
parent | c124e63d6d6cdd07b6d0fa4439fed878ed164fbb (diff) |
improved validation
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/__init__.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index 0906c016..1654ec4c 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -49,6 +49,8 @@ from ..yamlconf import build_raw_from_options from ..yamlconf.dumper import make_config_dump from ..yamlconf.loader import load_yaml_file +from ..validators.basic import valid_stripped_string +from ..validators.basic import valid_stripped_string_not_empty from ..validators.basic import valid_bool from ..validators.basic import valid_number from ..validators.basic import valid_float_f0 @@ -201,7 +203,7 @@ def _get_config_scheme() -> Dict: }, "external": { - "type": Option("", type=(lambda arg: str(arg).strip())), + "type": Option("", type=valid_stripped_string), }, }, @@ -211,17 +213,17 @@ def _get_config_scheme() -> Dict: }, "hid": { - "type": Option("", type=(lambda arg: str(arg).strip())), + "type": Option("", type=valid_stripped_string_not_empty), # Dynamic content }, "atx": { - "type": Option("", type=(lambda arg: str(arg).strip())), + "type": Option("", type=valid_stripped_string_not_empty), # Dynamic content }, "msd": { - "type": Option("", type=(lambda arg: str(arg).strip())), + "type": Option("", type=valid_stripped_string_not_empty), # Dynamic content }, @@ -258,7 +260,7 @@ def _get_config_scheme() -> Dict: "serial": Option("CAFEBABE"), "gadget": Option("kvmd", type=valid_otg_gadget), - "udc": Option("", type=(lambda arg: str(arg).strip())), + "udc": Option("", type=valid_stripped_string), "init_delay": Option(3.0, type=valid_float_f01), "msd": { |