Created
August 5, 2015 19:27
-
-
Save zygiss/4f027545021de43468be to your computer and use it in GitHub Desktop.
Retrieve list of states applicable to a minion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import argv | |
import salt.client | |
local = salt.client.LocalClient() | |
minion = str(argv[1]) | |
states = [] | |
result = local.cmd(minion, 'state.show_highstate') | |
for dict in result[minion].itervalues(): | |
try: | |
states.index(dict['__sls__']) | |
except ValueError: | |
states.append(dict['__sls__']) | |
print sorted(states) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment