mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #30403 from basepi/merge-forward-develop
Merge forward from 2015.8 to develop
This commit is contained in:
commit
dc95b28f9b
@ -60,8 +60,8 @@ else:
|
||||
_DFLT_MULTIPROCESSING_MODE = True
|
||||
|
||||
FLO_DIR = os.path.join(
|
||||
os.path.dirname(os.path.dirname(__file__)),
|
||||
'daemons', 'flo')
|
||||
os.path.dirname(__file__),
|
||||
'daemons', 'flo')
|
||||
|
||||
VALID_OPTS = {
|
||||
# The address of the salt master. May be specified as IP address or hostname
|
||||
|
@ -436,10 +436,16 @@ 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 long_range(
|
||||
ipaddress.ip_address(start),
|
||||
ipaddress.ip_address(end) + 1
|
||||
)]
|
||||
if _entry_extra:
|
||||
entries = [' '.join([str(ipaddress.ip_address(ip)), ' '.join(_entry_extra)]) for ip in long_range(
|
||||
ipaddress.ip_address(start),
|
||||
ipaddress.ip_address(end) + 1
|
||||
)]
|
||||
else:
|
||||
entries = [' '.join([str(ipaddress.ip_address(ip))]) for ip in long_range(
|
||||
ipaddress.ip_address(start),
|
||||
ipaddress.ip_address(end) + 1
|
||||
)]
|
||||
|
||||
elif settype == 'hash:net':
|
||||
networks = ipaddress.summarize_address_range(ipaddress.ip_address(start),
|
||||
@ -448,20 +454,32 @@ def check(set=None, entry=None, family='ipv4'):
|
||||
for network in networks:
|
||||
_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)])
|
||||
else:
|
||||
__network = ' '.join([str(_network[0])])
|
||||
else:
|
||||
__network = ' '.join([str(network), ' '.join(_entry_extra)])
|
||||
if _entry_extra:
|
||||
__network = ' '.join([str(network), ' '.join(_entry_extra)])
|
||||
else:
|
||||
__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)]
|
||||
else:
|
||||
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)])]
|
||||
else:
|
||||
entries = [' '.join([_entries[0]])]
|
||||
else:
|
||||
entries = [entry]
|
||||
else:
|
||||
|
@ -170,7 +170,7 @@ def info_available(*names, **kwargs):
|
||||
cmd.extend(batch[:batch_size])
|
||||
pkg_info.extend(
|
||||
re.split(
|
||||
'----*',
|
||||
'Information for package*',
|
||||
__salt__['cmd.run_stdout'](
|
||||
cmd,
|
||||
output_loglevel='trace',
|
||||
@ -183,6 +183,8 @@ def info_available(*names, **kwargs):
|
||||
for pkg_data in pkg_info:
|
||||
nfo = {}
|
||||
for line in [data for data in pkg_data.split('\n') if ':' in data]:
|
||||
if line.startswith('-----'):
|
||||
continue
|
||||
kw = [data.strip() for data in line.split(':', 1)]
|
||||
if len(kw) == 2 and kw[1]:
|
||||
nfo[kw[0].lower()] = kw[1]
|
||||
|
Loading…
Reference in New Issue
Block a user