mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Better approach without using python_shell=True.
This commit is contained in:
parent
5ac41f496d
commit
e6a4619ec1
1 changed files with 3 additions and 2 deletions
|
@ -8,6 +8,7 @@ from __future__ import absolute_import
|
|||
|
||||
# Import python libs
|
||||
import json
|
||||
import shlex
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils
|
||||
|
@ -55,8 +56,8 @@ def _osquery(sql, format='json'):
|
|||
'result': True,
|
||||
}
|
||||
|
||||
cmd = 'osqueryi --json "{0}"'.format(sql)
|
||||
res = __salt__['cmd.run_all'](cmd, python_shell=True)
|
||||
cmd = ['osqueryi'] + ['--json'] + [sql]
|
||||
res = __salt__['cmd.run_all'](cmd)
|
||||
if res['retcode'] == 0:
|
||||
ret['data'] = json.loads(res['stdout'])
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue