Handle new enhanced retcode 2

This commit is contained in:
twangboy 2019-03-20 18:20:08 -06:00
parent 679c4b2824
commit bfdc47bfa3
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB

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'])
)