summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2019-03-15 16:48:18 +1000
committerMatt Clay <matt@mystile.com>2019-03-15 10:10:41 -0700
commit7ee89d4ac6284b044a696c08d338303810cbc264 (patch)
tree48d52799b770c8c6e6d105ab6213a996256dc5ba
parent995a7e6453af1c6992a717c5d8e1dd7a83f987b8 (diff)
downloadansible-7ee89d4ac6284b044a696c08d338303810cbc264.tar.gz
win_chocolatey Fix incompatibilities with latest Chocolcatey release
-rw-r--r--changelogs/fragments/win_chocolatey-update.yaml2
-rw-r--r--lib/ansible/modules/windows/win_chocolatey.ps13
2 files changed, 4 insertions, 1 deletions
diff --git a/changelogs/fragments/win_chocolatey-update.yaml b/changelogs/fragments/win_chocolatey-update.yaml
new file mode 100644
index 0000000000..ed0f6c0a0c
--- /dev/null
+++ b/changelogs/fragments/win_chocolatey-update.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+- win_chocolatey - Fix incompatibilities with the latest release of Chocolatey ``v0.10.12+``
diff --git a/lib/ansible/modules/windows/win_chocolatey.ps1 b/lib/ansible/modules/windows/win_chocolatey.ps1
index df590b7ba8..d185f91ab5 100644
--- a/lib/ansible/modules/windows/win_chocolatey.ps1
+++ b/lib/ansible/modules/windows/win_chocolatey.ps1
@@ -155,7 +155,8 @@ Function Choco-IsInstalled
Fail-Json -obj $result -message "Error checking installation status for package 'package': $($_.Exception.Message)"
}
- if ($LastExitCode -ne 0) {
+ # Chocolatey v0.10.12 introduced enhanced exit codes, 2 means no results, e.g. no package
+ if ($LastExitCode -notin @(0, 2)) {
$result.rc = $LastExitCode
$result.command = "$script:executable list $options"
$result.stdout = $output | Out-String