mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #16993 from felskrone/expose_connected_minions
Expose connected minions through wheel-api
This commit is contained in:
commit
06e1fe69bd
@ -15,3 +15,4 @@ Full list of builtin wheel modules
|
||||
file_roots
|
||||
key
|
||||
pillar_roots
|
||||
minions
|
||||
|
7
doc/ref/wheel/all/salt.wheel.minions.rst
Normal file
7
doc/ref/wheel/all/salt.wheel.minions.rst
Normal file
@ -0,0 +1,7 @@
|
||||
==================
|
||||
salt.wheel.minions
|
||||
==================
|
||||
|
||||
.. automodule:: salt.wheel.minions
|
||||
:members:
|
||||
|
23
salt/wheel/minions.py
Normal file
23
salt/wheel/minions.py
Normal file
@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Wheel system wrapper for connected minions
|
||||
'''
|
||||
|
||||
from salt.utils.cache import CacheCli
|
||||
import salt.config
|
||||
import salt.utils.minion
|
||||
|
||||
|
||||
def connected():
|
||||
'''
|
||||
List all connected minions on a salt-master
|
||||
'''
|
||||
opts = salt.config.master_config(__opts__['conf_file'])
|
||||
minions = []
|
||||
|
||||
if opts.get('con_cache'):
|
||||
cache_cli = CacheCli(opts)
|
||||
minions = cache_cli.get_cached()
|
||||
else:
|
||||
minions = list(salt.utils.minions.CkMinions(opts).connected_ids())
|
||||
return minions
|
Loading…
Reference in New Issue
Block a user