summaryrefslogtreecommitdiff
path: root/kvmd/validators/hw.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-08 11:35:29 +0300
committerDevaev Maxim <[email protected]>2020-09-08 11:35:29 +0300
commit5ba0873c32be21fdff822dcac47095d944a29cd3 (patch)
tree8c423b5bcbbab9f4722f1b4992246dd8a881375b /kvmd/validators/hw.py
parentcf5114264b863a7e966a38c0448cf6e5c1214507 (diff)
stronger validators
Diffstat (limited to 'kvmd/validators/hw.py')
-rw-r--r--kvmd/validators/hw.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/kvmd/validators/hw.py b/kvmd/validators/hw.py
index 82d1221a..59a0363d 100644
--- a/kvmd/validators/hw.py
+++ b/kvmd/validators/hw.py
@@ -24,6 +24,7 @@ from typing import Any
from . import check_in_list
from . import check_re_match
+from . import check_len
from .basic import valid_number
@@ -44,7 +45,8 @@ def valid_gpio_pin_optional(arg: Any) -> int:
def valid_otg_gadget(arg: Any) -> str:
- return check_re_match(arg, "OTG gadget name", r"^[a-z_][a-z0-9_-]*$")[:255]
+ name = "OTG gadget name"
+ return check_len(check_re_match(arg, name, r"^[a-z_][a-z0-9_-]*$"), name, 255)
def valid_otg_id(arg: Any) -> int: