Adding new authorisations for reload on ip_ssh_eth0
This commit is contained in:
16
creolefuncs/netmask.py
Normal file
16
creolefuncs/netmask.py
Normal file
@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
def toCidr(ip,mask=False):
|
||||
""" Convert to CIDR notation
|
||||
ip can be like this : 192.168.5.100/255.255.255.0
|
||||
or you can provide the ip and the mask
|
||||
"""
|
||||
from IPy import IP
|
||||
try:
|
||||
if mask:
|
||||
data="{0}/{1}".format(ip,mask)
|
||||
else:
|
||||
data=ip
|
||||
return str(IP(data))
|
||||
except:
|
||||
return data
|
Reference in New Issue
Block a user