mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #30389 from jtand/ipset
Older versions of ipset don't support comments
This commit is contained in:
commit
3ac3804ddc
@ -429,7 +429,12 @@ def check(set=None, entry=None, family='ipv4'):
|
||||
start, end = _entry.split('-')
|
||||
|
||||
if settype == 'hash:ip':
|
||||
entries = [' '.join([str(ipaddress.ip_address(ip)), ' '.join(_entry_extra)]) for ip in range(
|
||||
if _entry_extra:
|
||||
entries = [' '.join([str(ipaddress.ip_address(ip)), ' '.join(_entry_extra)]) for ip in range(
|
||||
ipaddress.ip_address(start),
|
||||
ipaddress.ip_address(end) + 1
|
||||
)]
|
||||
entries = [' '.join([str(ipaddress.ip_address(ip))]) for ip in range(
|
||||
ipaddress.ip_address(start),
|
||||
ipaddress.ip_address(end) + 1
|
||||
)]
|
||||
@ -439,22 +444,31 @@ def check(set=None, entry=None, family='ipv4'):
|
||||
ipaddress.ip_address(end))
|
||||
entries = []
|
||||
for network in networks:
|
||||
entries.append(network.with_prefixlen)
|
||||
_network = [str(ip) for ip in ipaddress.ip_network(network)]
|
||||
if len(_network) == 1:
|
||||
__network = ' '.join([str(_network[0]), ' '.join(_entry_extra)])
|
||||
if _entry_extra:
|
||||
__network = ' '.join([str(_network[0]), ' '.join(_entry_extra)])
|
||||
__network = ' '.join([str(_network[0])])
|
||||
else:
|
||||
__network = ' '.join([str(network), ' '.join(_entry_extra)])
|
||||
if _entry_extra:
|
||||
__network = ' '.join([str(network), ' '.join(_entry_extra)])
|
||||
__network = ' '.join([str(network)])
|
||||
entries.append(__network)
|
||||
else:
|
||||
entries = [entry]
|
||||
|
||||
elif _entry.find('/') != -1 and _entry.count('/') == 1:
|
||||
if settype == 'hash:ip':
|
||||
entries = [' '.join([str(ip), ' '.join(_entry_extra)]) for ip in ipaddress.ip_network(_entry)]
|
||||
if _entry_extra:
|
||||
entries = [' '.join([str(ip), ' '.join(_entry_extra)]) for ip in ipaddress.ip_network(_entry)]
|
||||
entries = [' '.join([str(ip)]) for ip in ipaddress.ip_network(_entry)]
|
||||
elif settype == 'hash:net':
|
||||
_entries = [str(ip) for ip in ipaddress.ip_network(_entry)]
|
||||
if len(_entries) == 1:
|
||||
entries = [' '.join([_entries[0], ' '.join(_entry_extra)])]
|
||||
if _entry_extra:
|
||||
entries = [' '.join([_entries[0], ' '.join(_entry_extra)])]
|
||||
entries = [' '.join([_entries[0]])]
|
||||
else:
|
||||
entries = [entry]
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user