diff options
author | Devaev Maxim <[email protected]> | 2020-09-08 12:58:09 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-09-08 12:58:09 +0300 |
commit | 081797b2536149b41ca513e64c20de8ee40f5b6e (patch) | |
tree | deabbc59534b93b04f32ac57501bbb3d84e11b43 /kvmd/validators | |
parent | d528a3002e53bb7a5b5e6d9b5385252372738fbf (diff) |
refactoring
Diffstat (limited to 'kvmd/validators')
-rw-r--r-- | kvmd/validators/kvm.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kvmd/validators/kvm.py b/kvmd/validators/kvm.py index 5a4dd6c8..0374ebd8 100644 --- a/kvmd/validators/kvm.py +++ b/kvmd/validators/kvm.py @@ -34,6 +34,7 @@ from . import check_len from .basic import valid_stripped_string_not_empty from .basic import valid_number +from .basic import valid_string_list from .os import valid_printable_filename @@ -51,6 +52,14 @@ def valid_msd_image_name(arg: Any) -> str: return valid_printable_filename(arg, name="MSD image name") # pragma: nocover +def valid_info_fields(arg: Any, variants: Set[str]) -> Set[str]: + return set(valid_string_list( + arg=str(arg).strip(), + subval=(lambda field: check_string_in_list(field, "info field", variants)), + name="info fields list", + )) + + def valid_log_seek(arg: Any) -> int: return int(valid_number(arg, min=0, name="log seek")) |