Skip to content

Commit

Permalink
Handle new enhanced retcode 2
Browse files Browse the repository at this point in the history
  • Loading branch information
twangboy committed Mar 21, 2019
1 parent 679c4b2 commit bfdc47b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion salt/modules/chocolatey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
)
Expand Down

0 comments on commit bfdc47b

Please sign in to comment.