mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #31441 from cachedout/issue_30739
Include localhost minions in presence detection for runner
This commit is contained in:
commit
e480727d27
2 changed files with 5 additions and 3 deletions
|
@ -167,7 +167,7 @@ def present(subset=None, show_ipv4=False):
|
|||
minions = [m for m in present if m in subset] if subset else present
|
||||
else:
|
||||
ckminions = salt.utils.minions.CkMinions(__opts__)
|
||||
minions = ckminions.connected_ids(show_ipv4=show_ipv4, subset=subset)
|
||||
minions = ckminions.connected_ids(show_ipv4=show_ipv4, subset=subset, include_localhost=True)
|
||||
|
||||
connected = dict(minions) if show_ipv4 else sorted(minions)
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ class CkMinions(object):
|
|||
return []
|
||||
return list(minions)
|
||||
|
||||
def connected_ids(self, subset=None, show_ipv4=False):
|
||||
def connected_ids(self, subset=None, show_ipv4=False, include_localhost=False):
|
||||
'''
|
||||
Return a set of all connected minion ids, optionally within a subset
|
||||
'''
|
||||
|
@ -468,7 +468,9 @@ class CkMinions(object):
|
|||
except (AttributeError, IOError, OSError):
|
||||
continue
|
||||
for ipv4 in grains.get('ipv4', []):
|
||||
if ipv4 == '127.0.0.1' or ipv4 == '0.0.0.0':
|
||||
if ipv4 == '127.0.0.1' and not include_localhost:
|
||||
continue
|
||||
if ipv4 == '0.0.0.0':
|
||||
continue
|
||||
if ipv4 in addrs:
|
||||
if show_ipv4:
|
||||
|
|
Loading…
Add table
Reference in a new issue