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/validators/net.py | |
parent | c124e63d6d6cdd07b6d0fa4439fed878ed164fbb (diff) |
improved validation
Diffstat (limited to 'kvmd/validators/net.py')
-rw-r--r-- | kvmd/validators/net.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kvmd/validators/net.py b/kvmd/validators/net.py index cad87f07..ce875242 100644 --- a/kvmd/validators/net.py +++ b/kvmd/validators/net.py @@ -24,18 +24,18 @@ import socket from typing import Any -from . import check_not_none_string from . import check_re_match from . import check_any from .basic import valid_number +from .basic import valid_stripped_string_not_empty # ===== def valid_ip_or_host(arg: Any) -> str: name = "IP address or RFC-1123 hostname" return check_any( - arg=check_not_none_string(arg, name), + arg=valid_stripped_string_not_empty(arg, name), name=name, validators=[ valid_ip, @@ -47,7 +47,7 @@ def valid_ip_or_host(arg: Any) -> str: def valid_ip(arg: Any) -> str: name = "IP address" return check_any( - arg=check_not_none_string(arg, name), + arg=valid_stripped_string_not_empty(arg, name), name=name, validators=[ lambda arg: (arg, socket.inet_pton(socket.AF_INET, arg))[0], |