StrictMode fixes for win_get_url

This commit is contained in:
nitzmahone 2016-06-15 14:40:25 -07:00 committed by Matt Clay
parent 1f6c3766b0
commit 363ff55445

View file

@ -26,33 +26,24 @@ $result = New-Object psobject @{
changed = $false changed = $false
} }
If ($params.url) { $url = Get-AnsibleParam $params -name "url" -failifempty $true
$url = $params.url $dest = Get-AnsibleParam $params -name "dest" -failifempty $true
}
Else {
Fail-Json $result "missing required argument: url"
}
If ($params.dest) { $skip_certificate_validation = Get-AnsibleParam $params -name "skip_certificate_validation" -default $false
$dest = $params.dest $skip_certificate_validation = $skip_certificate_validation | ConvertTo-Bool
} $username = Get-AnsibleParam $params "username"
Else { $password = Get-AnsibleParam $params "password"
Fail-Json $result "missing required argument: dest"
}
$skip_certificate_validation = Get-Attr $params "skip_certificate_validation" $false | ConvertTo-Bool $proxy_url = Get-AnsibleParam $params "proxy_url"
$username = Get-Attr $params "username" $proxy_username = Get-AnsibleParam $params "proxy_username"
$password = Get-Attr $params "password" $proxy_password = Get-AnsibleParam $params "proxy_password"
$proxy_url = Get-Attr $params "proxy_url"
$proxy_username = Get-Attr $params "proxy_username"
$proxy_password = Get-Attr $params "proxy_password"
if($skip_certificate_validation){ if($skip_certificate_validation){
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
} }
$force = Get-Attr -obj $params -name "force" "yes" | ConvertTo-Bool $force = Get-AnsibleParam -obj $params -name "force" -default $true
$force = $force | ConvertTo-Bool
Function Download-File($result, $url, $dest, $username, $password, $proxy_url, $proxy_username, $proxy_password) { Function Download-File($result, $url, $dest, $username, $password, $proxy_url, $proxy_username, $proxy_password) {
$webClient = New-Object System.Net.WebClient $webClient = New-Object System.Net.WebClient