Created
December 8, 2015 23:06
-
-
Save anonymous/279350ea9a0accf2a530 to your computer and use it in GitHub Desktop.
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
def pillar_queries(pillar_queries): | |
''' | |
Execute a set of queries as described in a pillar key | |
Specified Pillar key must contain an array of dictionaries, | |
Each dictionary must contain a "query" and "query_id" key | |
CLI Example: | |
.. code-block:: bash | |
salt '*' osquery.pillar_queries "select * from users;" | |
''' | |
queries = __salt__['pillar.item'](pillar_queries)[pillar_queries] | |
results = [] | |
for q in queries: | |
q_res = _osquery(q['query']) | |
results.append( | |
{'query_id':q['query_id'], | |
'results':q_res, | |
'fqdn':__salt__['grains.get']("fqdn"), | |
}) | |
return results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment