added parameter for allowing prerelease packages in win_chocolatey for #33243 (#37205)

make sure we don't pass it to state absent

removed trailing whitespace

forcing CI
This commit is contained in:
Andreas Mosti 2018-03-21 15:46:40 +01:00 committed by Dag Wieers
parent aadbb6c0b4
commit ca634486f1
2 changed files with 25 additions and 3 deletions

View file

@ -30,13 +30,14 @@ $packageparams = Get-AnsibleParam -obj $params -name "params" -type "str"
$allowemptychecksums = Get-AnsibleParam -obj $params -name "allow_empty_checksums" -type "bool" -default $false
$ignorechecksums = Get-AnsibleParam -obj $params -name "ignore_checksums" -type "bool" -default $false
$ignoredependencies = Get-AnsibleParam -obj $params -name "ignore_dependencies" -type "bool" -default $false
$allowprerelease = Get-AnsibleParam -obj $params -name "allow_prerelease" -type "bool" -default $false
$skipscripts = Get-AnsibleParam -obj $params -name "skip_scripts" -type "bool" -default $false
$proxy_url = Get-AnsibleParam -obj $params -name "proxy_url" -type "str"
$proxy_username = Get-AnsibleParam -obj $params -name "proxy_username" -type "str"
$proxy_password = Get-AnsibleParam -obj $params -name "proxy_password" -type "str" -failifempty ($proxy_username -ne $null)
$result = @{
changed = $false
changed = $false
}
if ($upgrade)
@ -194,6 +195,7 @@ Function Choco-Upgrade
[bool] $ignorechecksums,
[bool] $ignoredependencies,
[bool] $allowdowngrade,
[bool] $allowprerelease,
[string] $proxy_url,
[string] $proxy_username,
[string] $proxy_password
@ -261,6 +263,11 @@ Function Choco-Upgrade
$options += "--allow-downgrade"
}
if ($allowprerelease)
{
$options += "--prerelease"
}
if ($proxy_url)
{
$options += "--proxy=`"'$proxy_url'`""
@ -326,6 +333,7 @@ Function Choco-Install
[bool] $ignorechecksums,
[bool] $ignoredependencies,
[bool] $allowdowngrade,
[bool] $allowprerelease,
[string] $proxy_url,
[string] $proxy_username,
[string] $proxy_password
@ -340,7 +348,8 @@ Function Choco-Install
-packageparams $packageparams -allowemptychecksums $allowemptychecksums `
-ignorechecksums $ignorechecksums -ignoredependencies $ignoredependencies `
-allowdowngrade $allowdowngrade -proxy_url $proxy_url `
-proxy_username $proxy_username -proxy_password $proxy_password
-proxy_username $proxy_username -proxy_password $proxy_password `
-allowprerelease $allowprerelease
return
}
elseif (-not $force)
@ -386,6 +395,11 @@ Function Choco-Install
$options += "--allow-empty-checksums"
}
if ($allowprerelease)
{
$options += "--prerelease"
}
if ($ignorechecksums)
{
$options += "--ignore-checksums"
@ -529,7 +543,8 @@ if ($state -in ("downgrade", "latest", "present", "reinstalled")) {
-packageparams $packageparams -allowemptychecksums $allowemptychecksums `
-ignorechecksums $ignorechecksums -ignoredependencies $ignoredependencies `
-allowdowngrade ($state -eq "downgrade") -proxy_url $proxy_url `
-proxy_username $proxy_username -proxy_password $proxy_password
-proxy_username $proxy_username -proxy_password $proxy_password `
-allowprerelease $allowprerelease
}
Exit-Json -obj $result

View file

@ -111,6 +111,13 @@ options:
- See notes in C(proxy_username) when dealing with double quotes in a
password.
version_added: '2.4'
allow_prerelease:
description:
- Allow install of prerelease packages.
- If state C(state) is C(latest) the highest prerelease package will be installed.
type: bool
default: 'no'
version_added: '2.6'
notes:
- Provide the C(version) parameter value as a string (e.g. C('6.1')), otherwise it
is considered to be a floating-point number and depending on the locale could