From 37508fde5fc9c491448d87919462cdd257758e50 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Thu, 6 Jul 2017 01:56:43 +0200 Subject: [PATCH] win_get_url: Replace skip_certificate_validation with validate_certs (#26464) This is part of the effort to make win_get_url parameters conform to other modules. The option `validate_certs` is the common option for this. See also #20160 --- lib/ansible/modules/windows/win_get_url.ps1 | 11 +++++++++-- lib/ansible/modules/windows/win_get_url.py | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/ansible/modules/windows/win_get_url.ps1 b/lib/ansible/modules/windows/win_get_url.ps1 index bc1b669d0ec..e278304f7d6 100644 --- a/lib/ansible/modules/windows/win_get_url.ps1 +++ b/lib/ansible/modules/windows/win_get_url.ps1 @@ -24,7 +24,8 @@ $check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "b $url = Get-AnsibleParam -obj $params -name "url" -type "str" -failifempty $true $dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true -$skip_certificate_validation = Get-AnsibleParam -obj $params -name "skip_certificate_validation" -type "bool" -default $false +$skip_certificate_validation = Get-AnsibleParam -obj $params -name "skip_certificate_validation" -type "bool" +$validate_certs = Get-AnsibleParam -obj $params -name "validate_certs" -type "bool" -default $true $username = Get-AnsibleParam -obj $params -name "username" -type "str" $password = Get-AnsibleParam -obj $params -name "password" -type "str" $proxy_url = Get-AnsibleParam -obj $params -name "proxy_url" -type "str" @@ -40,7 +41,13 @@ $result = @{ } } -if($skip_certificate_validation){ +# If skip_certificate_validation was specified, use validate_certs +if ($skip_certificate_validation -ne $null) { + Add-DeprecationWarning -obj $result -msg "The parameter 'skip_vertificate_validation' is being replaced with 'validate_certs'" -version 2.8 + $validate_certs = -not $skip_certificate_validation +} + +if (-not $validate_certs) { [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} } diff --git a/lib/ansible/modules/windows/win_get_url.py b/lib/ansible/modules/windows/win_get_url.py index a0e4f30fb6c..beaf86b9117 100644 --- a/lib/ansible/modules/windows/win_get_url.py +++ b/lib/ansible/modules/windows/win_get_url.py @@ -25,7 +25,6 @@ ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['stableinterface'], 'supported_by': 'core'} - DOCUMENTATION = r''' --- module: win_get_url @@ -73,9 +72,19 @@ options: default: null skip_certificate_validation: description: - - Skip SSL certificate validation if true - required: false - default: false + - This option is deprecated since v2.4, please use C(validate_certs) instead. + - If C(yes), SSL certificates will not be validated. This should only be used + on personally controlled sites using self-signed certificates. + default: 'no' + type: bool + validate_certs: + description: + - If C(no), SSL certificates will not be validated. This should only be used + on personally controlled sites using self-signed certificates. + - If C(skip_certificate_validation) was set, it overrides this option. + default: 'yes' + type: bool + version_added: '2.4' proxy_url: description: - The full URL of the proxy server to download through.