Better approach without using python_shell=True.

This commit is contained in:
Gareth J. Greenaway 2017-08-15 16:01:32 -07:00
parent 5ac41f496d
commit e6a4619ec1

View file

@ -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: