mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add generic ip address validation function
This commit is contained in:
parent
9f547205a0
commit
d1c2038081
1 changed files with 8 additions and 0 deletions
|
@ -81,6 +81,14 @@ def ipv6_addr(addr):
|
|||
return __ip_addr(addr, socket.AF_INET6)
|
||||
|
||||
|
||||
def ip_addr(addr):
|
||||
'''
|
||||
Returns True if the IPv4 or IPv6 address (and optional subnet) are valid,
|
||||
otherwise returns False.
|
||||
'''
|
||||
return ipv4_addr(addr) or ipv6_addr(addr)
|
||||
|
||||
|
||||
def netmask(mask):
|
||||
'''
|
||||
Returns True if the value passed is a valid netmask, otherwise return False
|
||||
|
|
Loading…
Add table
Reference in a new issue