Skip to content

Commit

Permalink
Merge pull request #52209 from twangboy/fix_choco_retcode
Browse files Browse the repository at this point in the history
Handle Chocolatey's new Enhanced Exit Codes
  • Loading branch information
thatch45 authored Apr 12, 2019
2 parents dd7a4ba + 7aec2d3 commit 262516c
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 262516c

Please sign in to comment.