mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Utilize prepared grains var in master-side ipcidr matching
At least partially fixes #29188 et al. (tnx @fantasy88 for analysis)
This commit is contained in:
parent
415654ee9e
commit
4e4e0926da
1 changed files with 4 additions and 4 deletions
|
@ -348,18 +348,18 @@ class CkMinions(object):
|
|||
tgt = ipaddress.ip_network(tgt)
|
||||
# Target is a network
|
||||
proto = 'ipv{0}'.format(tgt.version)
|
||||
if proto not in self.opts['grains']:
|
||||
if proto not in grains:
|
||||
match = False
|
||||
else:
|
||||
match = salt.utils.network.in_subnet(tgt, self.opts['grains'][proto])
|
||||
match = salt.utils.network.in_subnet(tgt, grains[proto])
|
||||
except: # pylint: disable=bare-except
|
||||
try:
|
||||
# Target should be an address
|
||||
proto = 'ipv{0}'.format(ipaddress.ip_address(tgt).version)
|
||||
if proto not in self.opts['grains']:
|
||||
if proto not in grains:
|
||||
match = False
|
||||
else:
|
||||
match = tgt in self.opts['grains'][proto]
|
||||
match = tgt in grains[proto]
|
||||
except: # pylint: disable=bare-except
|
||||
log.error('Invalid IP/CIDR target {0}"'.format(tgt))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue