mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #37459 from twangboy/fix_dsc_json_msg_2016.3
Fix error message when ConvertTo-Json not supported [DO NOT MERGE FORWARD]
This commit is contained in:
commit
3591bf0f58
1 changed files with 10 additions and 1 deletions
|
@ -47,7 +47,16 @@ def _pshell(cmd, cwd=None):
|
|||
if 'convertto-json' not in cmd.lower():
|
||||
cmd = ' '.join([cmd, '| ConvertTo-Json'])
|
||||
log.debug('DSC: {0}'.format(cmd))
|
||||
ret = __salt__['cmd.shell'](cmd, shell='powershell', cwd=cwd)
|
||||
ret = __salt__['cmd.run_all'](cmd, shell='powershell', cwd=cwd,
|
||||
python_shell=True, ignore_retcode=True)
|
||||
|
||||
if ret['retcode']:
|
||||
log.debug('Error running command: {0}'.format(cmd))
|
||||
log.debug(ret)
|
||||
return False
|
||||
|
||||
ret = ret['stdout']
|
||||
|
||||
try:
|
||||
ret = json.loads(ret, strict=False)
|
||||
except ValueError:
|
||||
|
|
Loading…
Add table
Reference in a new issue