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
$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
# 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)]
[string]$packageparams,
[Parameter(Mandatory=$false, Position=7)]
[bool]$allowemptychecksums,
[Parameter(Mandatory=$false, Position=8)]
[bool]$ignorechecksums,
[Parameter(Mandatory=$false, Position=9)]
[bool]$ignoredependencies
)
@ -161,6 +167,16 @@ Function Choco-Upgrade
$cmd += " -params '$packageparams'"
}
if ($allowemptychecksums)
{
$cmd += " --allow-empty-checksums"
}
if ($ignorechecksums)
{
$cmd += " --ignore-checksums"
}
if ($ignoredependencies)
{
$cmd += " -ignoredependencies"
@ -204,6 +220,10 @@ Function Choco-Install
[Parameter(Mandatory=$false, Position=7)]
[string]$packageparams,
[Parameter(Mandatory=$false, Position=8)]
[bool]$allowemptychecksums,
[Parameter(Mandatory=$false, Position=9)]
[bool]$ignorechecksums,
[Parameter(Mandatory=$false, Position=10)]
[bool]$ignoredependencies
)
@ -213,6 +233,7 @@ Function Choco-Install
{
Choco-Upgrade -package $package -version $version -source $source -force $force `
-installargs $installargs -packageparams $packageparams `
-allowemptychecksums $allowemptychecksums -ignorechecksums $ignorechecksums `
-ignoredependencies $ignoredependencies
return
@ -251,6 +272,16 @@ Function Choco-Install
$cmd += " -params '$packageparams'"
}
if ($allowemptychecksums)
{
$cmd += " --allow-empty-checksums"
}
if ($ignorechecksums)
{
$cmd += " --ignore-checksums"
}
if ($ignoredependencies)
{
$cmd += " -ignoredependencies"
@ -322,7 +353,8 @@ Try
{
Choco-Install -package $package -version $version -source $source `
-force $force -upgrade $upgrade -installargs $installargs `
-packageparams $packageparams -ignoredependencies $ignoredependencies
-packageparams $packageparams -allowemptychecksums $allowemptychecksums `
-ignorechecksums $ignorechecksums -ignoredependencies $ignoredependencies
}
else
{
@ -336,3 +368,4 @@ Catch
Fail-Json $result $_.Exception.Message
}

@ -80,6 +80,18 @@ options:
require: false
default: null
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:
description:
- Ignore dependencies, only install/upgrade the package itself

Loading…
Cancel
Save