Merge pull request #16993 from felskrone/expose_connected_minions

Expose connected minions through wheel-api
This commit is contained in:
Seth House 2014-10-29 12:03:35 -05:00
commit 06e1fe69bd
3 changed files with 31 additions and 0 deletions

View File

@ -15,3 +15,4 @@ Full list of builtin wheel modules
file_roots
key
pillar_roots
minions

View File

@ -0,0 +1,7 @@
==================
salt.wheel.minions
==================
.. automodule:: salt.wheel.minions
:members:

23
salt/wheel/minions.py Normal file
View 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