pass flag to choco, allowemptychecksums and ignorechecksums (#2722)

pull/18777/head
Greyeye 8 years ago committed by Matt Clay
parent 75f395dd34
commit 4bae025666

@ -37,6 +37,8 @@ $state = Get-Attr -obj $params -name state -default "present"
$installargs = Get-Attr -obj $params -name install_args -default $null $installargs = Get-Attr -obj $params -name install_args -default $null
$packageparams = Get-Attr -obj $params -name params -default $null $packageparams = Get-Attr -obj $params -name params -default $null
$allowemptychecksums = Get-Attr -obj $params -name allow_empty_checksums -default "false" | ConvertTo-Bool
$ignorechecksums = Get-Attr -obj $params -name ignore_checksums -default "false" | ConvertTo-Bool
$ignoredependencies = Get-Attr -obj $params -name ignore_dependencies -default "false" | ConvertTo-Bool $ignoredependencies = Get-Attr -obj $params -name ignore_dependencies -default "false" | ConvertTo-Bool
# as of chocolatey 0.9.10, nonzero success exit codes can be returned # as of chocolatey 0.9.10, nonzero success exit codes can be returned
@ -126,6 +128,10 @@ Function Choco-Upgrade
[Parameter(Mandatory=$false, Position=6)] [Parameter(Mandatory=$false, Position=6)]
[string]$packageparams, [string]$packageparams,
[Parameter(Mandatory=$false, Position=7)] [Parameter(Mandatory=$false, Position=7)]
[bool]$allowemptychecksums,
[Parameter(Mandatory=$false, Position=8)]
[bool]$ignorechecksums,
[Parameter(Mandatory=$false, Position=9)]
[bool]$ignoredependencies [bool]$ignoredependencies
) )
@ -161,6 +167,16 @@ Function Choco-Upgrade
$cmd += " -params '$packageparams'" $cmd += " -params '$packageparams'"
} }
if ($allowemptychecksums)
{
$cmd += " --allow-empty-checksums"
}
if ($ignorechecksums)
{
$cmd += " --ignore-checksums"
}
if ($ignoredependencies) if ($ignoredependencies)
{ {
$cmd += " -ignoredependencies" $cmd += " -ignoredependencies"
@ -204,6 +220,10 @@ Function Choco-Install
[Parameter(Mandatory=$false, Position=7)] [Parameter(Mandatory=$false, Position=7)]
[string]$packageparams, [string]$packageparams,
[Parameter(Mandatory=$false, Position=8)] [Parameter(Mandatory=$false, Position=8)]
[bool]$allowemptychecksums,
[Parameter(Mandatory=$false, Position=9)]
[bool]$ignorechecksums,
[Parameter(Mandatory=$false, Position=10)]
[bool]$ignoredependencies [bool]$ignoredependencies
) )
@ -213,6 +233,7 @@ Function Choco-Install
{ {
Choco-Upgrade -package $package -version $version -source $source -force $force ` Choco-Upgrade -package $package -version $version -source $source -force $force `
-installargs $installargs -packageparams $packageparams ` -installargs $installargs -packageparams $packageparams `
-allowemptychecksums $allowemptychecksums -ignorechecksums $ignorechecksums `
-ignoredependencies $ignoredependencies -ignoredependencies $ignoredependencies
return return
@ -251,6 +272,16 @@ Function Choco-Install
$cmd += " -params '$packageparams'" $cmd += " -params '$packageparams'"
} }
if ($allowemptychecksums)
{
$cmd += " --allow-empty-checksums"
}
if ($ignorechecksums)
{
$cmd += " --ignore-checksums"
}
if ($ignoredependencies) if ($ignoredependencies)
{ {
$cmd += " -ignoredependencies" $cmd += " -ignoredependencies"
@ -322,7 +353,8 @@ Try
{ {
Choco-Install -package $package -version $version -source $source ` Choco-Install -package $package -version $version -source $source `
-force $force -upgrade $upgrade -installargs $installargs ` -force $force -upgrade $upgrade -installargs $installargs `
-packageparams $packageparams -ignoredependencies $ignoredependencies -packageparams $packageparams -allowemptychecksums $allowemptychecksums `
-ignorechecksums $ignorechecksums -ignoredependencies $ignoredependencies
} }
else else
{ {
@ -336,3 +368,4 @@ Catch
Fail-Json $result $_.Exception.Message Fail-Json $result $_.Exception.Message
} }

@ -80,6 +80,18 @@ options:
require: false require: false
default: null default: null
version_added: '2.1' version_added: '2.1'
allow_empty_checksums:
description:
- Allow empty Checksums to be used
require: false
default: false
version_added: '2.2'
ignore_checksums:
description:
- Ignore Checksums
require: false
default: false
version_added: '2.2'
ignore_dependencies: ignore_dependencies:
description: description:
- Ignore dependencies, only install/upgrade the package itself - Ignore dependencies, only install/upgrade the package itself

Loading…
Cancel
Save