summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
authornitzmahone <mdavis@ansible.com>2016-06-15 14:40:25 -0700
committernitzmahone <mdavis@ansible.com>2016-06-15 14:46:56 -0700
commitd4eaeac8c9c1efe43c920c0ab753b213e9e1e3ca (patch)
tree3c5e6c6c68a94578df76ced3be3ca6135b1c524c /windows
parent949916a155380e84722272c5c294c3ec9c9449d0 (diff)
downloadansible-modules-core-d4eaeac8c9c1efe43c920c0ab753b213e9e1e3ca.tar.gz
StrictMode fixes for win_get_url
Diffstat (limited to 'windows')
-rw-r--r--windows/win_get_url.ps131
1 files changed, 11 insertions, 20 deletions
diff --git a/windows/win_get_url.ps1 b/windows/win_get_url.ps1
index 1f0e6580..f24b8740 100644
--- a/windows/win_get_url.ps1
+++ b/windows/win_get_url.ps1
@@ -26,33 +26,24 @@ $result = New-Object psobject @{
changed = $false
}
-If ($params.url) {
- $url = $params.url
-}
-Else {
- Fail-Json $result "missing required argument: url"
-}
-
-If ($params.dest) {
- $dest = $params.dest
-}
-Else {
- Fail-Json $result "missing required argument: dest"
-}
+$url = Get-AnsibleParam $params -name "url" -failifempty $true
+$dest = Get-AnsibleParam $params -name "dest" -failifempty $true
-$skip_certificate_validation = Get-Attr $params "skip_certificate_validation" $false | ConvertTo-Bool
-$username = Get-Attr $params "username"
-$password = Get-Attr $params "password"
+$skip_certificate_validation = Get-AnsibleParam $params -name "skip_certificate_validation" -default $false
+$skip_certificate_validation = $skip_certificate_validation | ConvertTo-Bool
+$username = Get-AnsibleParam $params "username"
+$password = Get-AnsibleParam $params "password"
-$proxy_url = Get-Attr $params "proxy_url"
-$proxy_username = Get-Attr $params "proxy_username"
-$proxy_password = Get-Attr $params "proxy_password"
+$proxy_url = Get-AnsibleParam $params "proxy_url"
+$proxy_username = Get-AnsibleParam $params "proxy_username"
+$proxy_password = Get-AnsibleParam $params "proxy_password"
if($skip_certificate_validation){
[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) {
$webClient = New-Object System.Net.WebClient