mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Add the manage runner
This commit is contained in:
parent
9c79dabdae
commit
bc933f2e31
21
salt/runners/manage.py
Normal file
21
salt/runners/manage.py
Normal file
@ -0,0 +1,21 @@
|
||||
'''
|
||||
General management functions for salt, tools like seeing what hosts are up
|
||||
and what hosts are down
|
||||
'''
|
||||
|
||||
# Import salt modules
|
||||
import salt.client
|
||||
import salt.cli.key
|
||||
|
||||
def down():
|
||||
'''
|
||||
Print a list of all the down or unresponsive salt minions
|
||||
'''
|
||||
client = salt.client.LocalClient(__opts__['config'])
|
||||
key = salt.cli.key(__opts__)
|
||||
minions = client.cmd('*', 'test.ping', timeout=1)
|
||||
keys = key._keys('acc')
|
||||
for minion in minions:
|
||||
keys.remove(minion)
|
||||
for minion in sorted(keys):
|
||||
print minion
|
Loading…
Reference in New Issue
Block a user