Merge pull request #52209 from twangboy/fix_choco_retcode

Handle Chocolatey's new Enhanced Exit Codes
This commit is contained in:
Thomas S Hatch 2019-04-12 10:01:28 -06:00 committed by GitHub
commit 262516c63a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -291,7 +291,12 @@ def list_(narrow=None,
result = __salt__['cmd.run_all'](cmd, python_shell=False)
if result['retcode'] != 0:
# Chocolatey introduced Enhanced Exit Codes starting with version 0.10.12
# Exit Code 2 means there were no results, but is not a failure
# This may start to effect other functions in the future as Chocolatey
# moves more functions to this new paradigm
# https://github.com/chocolatey/choco/issues/1758
if result['retcode'] not in [0, 2]:
raise CommandExecutionError(
'Running chocolatey failed: {0}'.format(result['stdout'])
)