mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Port #51521 to master
This commit is contained in:
parent
69ac5a36f9
commit
9210fc7e3c
1 changed files with 3 additions and 2 deletions
|
@ -1225,7 +1225,7 @@ def ip_in_subnet(ip_addr, cidr):
|
|||
|
||||
def convert_cidr(cidr):
|
||||
"""
|
||||
returns the network and subnet mask of a cidr addr
|
||||
returns the network address, subnet mask and broadcast address of a cidr address
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
|
@ -1235,11 +1235,12 @@ def convert_cidr(cidr):
|
|||
|
||||
salt '*' network.convert_cidr 172.31.0.0/16
|
||||
"""
|
||||
ret = {"network": None, "netmask": None}
|
||||
ret = {"network": None, "netmask": None, "broadcast": None}
|
||||
cidr = calc_net(cidr)
|
||||
network_info = ipaddress.ip_network(cidr)
|
||||
ret["network"] = six.text_type(network_info.network_address)
|
||||
ret["netmask"] = six.text_type(network_info.netmask)
|
||||
ret["broadcast"] = six.text_type(network_info.broadcast_address)
|
||||
return ret
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue