mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Win deprecate 2.8 (#45473)
* Remove deprecated/expired functionality * win:_msi: Remove the win_msi module * removed some missed deprecated return options and added porting guide reference Co-authored-by: dagwieers <dagwieers@users.noreply.github.com>
This commit is contained in:
parent
ec6d82435f
commit
01398f61d5
12 changed files with 32 additions and 184 deletions
|
@ -0,0 +1,6 @@
|
|||
removed_features:
|
||||
- win_feature - Removed deprecated 'restart_needed' returned boolean, use standardized 'reboot_required' instead
|
||||
- win_package - Removed deprecated 'restart_required' returned boolean, use standardized 'reboot_required' instead
|
||||
- win_package - Removed deprecated 'exit_code' returned int, use standardized 'rc' instead
|
||||
- win_get_url - Removed deprecated 'win_get_url' returned dictionary, contained values are returned directly
|
||||
- win_get_url - Removed deprecated 'skip_certificate_validation' parameter, use standardized 'validate_certs' instead
|
|
@ -57,6 +57,19 @@ Noteworthy module changes
|
|||
* The ``win_scheduled_task`` module deprecated support for specifying a trigger repetition as a list and this format
|
||||
will be removed in Ansible 2.12. Instead specify the repetition as a dictionary value.
|
||||
|
||||
* The ``win_feature`` module has removed the deprecated ``restart_needed`` return value, use the standardised
|
||||
``reboot_required`` value instead.
|
||||
|
||||
* The ``win_package`` module has removed the deprecated ``restart_required`` and ``exit_code`` return value, use the
|
||||
standardised ``reboot_required`` and ``rc`` value instead.
|
||||
|
||||
* The ``win_get_url`` module has removed the deprecated ``win_get_url`` return dictionary, contained values are
|
||||
returned directly.
|
||||
|
||||
* The ``win_get_url`` module has removed the deprecated ``skip_certificate_validation`` option, use the standardised
|
||||
``validate_certs`` option instead.
|
||||
|
||||
|
||||
Plugins
|
||||
=======
|
||||
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
#!powershell
|
||||
|
||||
# Copyright: (c) 2014, Matt Martz <matt@sivel.net>, and others
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
#Requires -Module Ansible.ModuleUtils.Legacy
|
||||
|
||||
$params = Parse-Args $args -supports_check_mode $true
|
||||
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
|
||||
|
||||
$path = Get-AnsibleParam -obj $params -name "path" -type "path" -failifempty $true
|
||||
$state = Get-AnsibleParam -obj $params -name "state" -type "str" -default "present" -validateset "absent","present"
|
||||
$creates = Get-AnsibleParam -obj $params -name "creates" -type "path"
|
||||
$removes = Get-AnsibleParam -obj $params -name "removes" -type "path"
|
||||
$extra_args = Get-AnsibleParam -obj $params -name "extra_args" -type "str" -default ""
|
||||
$wait = Get-AnsibleParam -obj $params -name "wait" -type "bool" -default $false
|
||||
|
||||
$result = @{
|
||||
changed = $false
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $path)) {
|
||||
Fail-Json $result "The MSI file ($path) was not found."
|
||||
}
|
||||
|
||||
if ($creates -and (Test-Path -Path $creates)) {
|
||||
Exit-Json $result "The 'creates' file or directory ($creates) already exists."
|
||||
}
|
||||
|
||||
if ($removes -and -not (Test-Path -Path $removes)) {
|
||||
Exit-Json $result "The 'removes' file or directory ($removes) does not exist."
|
||||
}
|
||||
|
||||
if (-not $check_mode) {
|
||||
|
||||
$logfile = [IO.Path]::GetTempFileName()
|
||||
if ($state -eq "absent") {
|
||||
Start-Process -FilePath msiexec.exe -ArgumentList "/x `"$path`" /qn /log $logfile $extra_args" -Verb Runas -Wait:$wait
|
||||
} else {
|
||||
Start-Process -FilePath msiexec.exe -ArgumentList "/i `"$path`" /qn /log $logfile $extra_args" -Verb Runas -Wait:$wait
|
||||
}
|
||||
$result.log = Get-Content $logfile | Out-String
|
||||
Remove-Item $logfile
|
||||
|
||||
}
|
||||
|
||||
$result.changed = $true
|
||||
|
||||
Exit-Json $result
|
|
@ -108,7 +108,4 @@ $result.reboot_required = ConvertTo-Bool -obj $action_results.RestartNeeded
|
|||
# controls whether Ansible will fail or not
|
||||
$result.failed = (-not $action_results.Success)
|
||||
|
||||
# DEPRECATED 2.4, remove in 2.8 (standardize naming to "reboot_required")
|
||||
$result.restart_needed = $result.reboot_required
|
||||
|
||||
Exit-Json -obj $result
|
||||
|
|
|
@ -139,10 +139,4 @@ reboot_required:
|
|||
returned: success
|
||||
type: boolean
|
||||
sample: True
|
||||
restart_needed:
|
||||
description: DEPRECATED in Ansible 2.4 (refer to C(reboot_required) instead). True when the target server requires a reboot to complete updates
|
||||
(no further updates can be installed until after a reboot)
|
||||
returned: success
|
||||
type: boolean
|
||||
sample: True
|
||||
'''
|
||||
|
|
|
@ -154,7 +154,6 @@ $url = Get-AnsibleParam -obj $params -name "url" -type "str" -failifempty $true
|
|||
$dest = Get-AnsibleParam -obj $params -name "dest" -type "path" -failifempty $true
|
||||
$timeout = Get-AnsibleParam -obj $params -name "timeout" -type "int" -default 10
|
||||
$headers = Get-AnsibleParam -obj $params -name "headers" -type "dict" -default @{}
|
||||
$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
|
||||
$url_username = Get-AnsibleParam -obj $params -name "url_username" -type "str" -aliases "username"
|
||||
$url_password = Get-AnsibleParam -obj $params -name "url_password" -type "str" -aliases "password"
|
||||
|
@ -170,11 +169,6 @@ $result = @{
|
|||
dest = $dest
|
||||
elapsed = 0
|
||||
url = $url
|
||||
# This is deprecated as of v2.4, remove in v2.8
|
||||
win_get_url = @{
|
||||
dest = $dest
|
||||
url = $url
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $use_proxy -and ($proxy_url -or $proxy_username -or $proxy_password)) {
|
||||
|
@ -200,12 +194,6 @@ if ($url_username) {
|
|||
|
||||
}
|
||||
|
||||
# If skip_certificate_validation was specified, use validate_certs
|
||||
if ($skip_certificate_validation -ne $null) {
|
||||
Add-DeprecationWarning -obj $result -message "The parameter 'skip_certificate_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 }
|
||||
}
|
||||
|
@ -225,7 +213,6 @@ if (Test-Path -LiteralPath $dest -PathType Container) {
|
|||
Fail-Json -obj $result -message "The destination path '$dest' does not exist, or is not visible to the current user. Ensure download destination folder exists (perhaps using win_file state=directory) before win_get_url runs."
|
||||
}
|
||||
$result.dest = $dest
|
||||
$result.win_get_url.dest = $dest
|
||||
|
||||
# Enable TLS1.1/TLS1.2 if they're available but disabled (eg. .NET 4.5)
|
||||
$security_protocols = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::SystemDefault
|
||||
|
|
|
@ -65,13 +65,6 @@ options:
|
|||
type: bool
|
||||
default: 'no'
|
||||
version_added: "2.5"
|
||||
skip_certificate_validation:
|
||||
description:
|
||||
- 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.
|
||||
type: bool
|
||||
default: 'no'
|
||||
validate_certs:
|
||||
description:
|
||||
- If C(no), SSL certificates will not be validated. This should only be used
|
||||
|
|
|
@ -28,7 +28,6 @@ $creates_service = Get-AnsibleParam -obj $params -name "creates_service" -type "
|
|||
$result = @{
|
||||
changed = $false
|
||||
reboot_required = $false
|
||||
restart_required = $false # deprecate in 2.8
|
||||
}
|
||||
|
||||
if ($arguments -ne $null) {
|
||||
|
@ -362,7 +361,6 @@ if ($state -eq "absent") {
|
|||
}
|
||||
|
||||
$result.rc = $process_result.rc
|
||||
$result.exit_code = $process_result.rc # deprecate in 2.8
|
||||
if ($valid_return_codes -notcontains $process_result.rc) {
|
||||
$result.stdout = Convert-Encoding -string $process_result.stdout
|
||||
$result.stderr = Convert-Encoding -string $process_result.stderr
|
||||
|
@ -376,7 +374,6 @@ if ($state -eq "absent") {
|
|||
|
||||
if ($process_result.rc -eq 3010) {
|
||||
$result.reboot_required = $true
|
||||
$result.restart_required = $true
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
@ -445,7 +442,6 @@ if ($state -eq "absent") {
|
|||
}
|
||||
|
||||
$result.rc = $process_result.rc
|
||||
$result.exit_code = $process_result.rc # deprecate in 2.8
|
||||
if ($valid_return_codes -notcontains $process_result.rc) {
|
||||
$result.stdout = Convert-Encoding -string $process_result.stdout
|
||||
$result.stderr = Convert-Encoding -string $process_result.stderr
|
||||
|
@ -459,7 +455,6 @@ if ($state -eq "absent") {
|
|||
|
||||
if ($process_result.rc -eq 3010) {
|
||||
$result.reboot_required = $true
|
||||
$result.restart_required = $true
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
|
|
@ -215,11 +215,6 @@ EXAMPLES = r'''
|
|||
'''
|
||||
|
||||
RETURN = r'''
|
||||
exit_code:
|
||||
description: See rc, this will be removed in favour of rc in Ansible 2.6.
|
||||
returned: change occured
|
||||
type: int
|
||||
sample: 0
|
||||
log:
|
||||
description: The contents of the MSI log.
|
||||
returned: change occured and package is an MSI
|
||||
|
@ -236,12 +231,6 @@ reboot_required:
|
|||
returned: always
|
||||
type: bool
|
||||
sample: True
|
||||
restart_required:
|
||||
description: See reboot_required, this will be removed in favour of
|
||||
reboot_required in Ansible 2.6
|
||||
returned: always
|
||||
type: bool
|
||||
sample: True
|
||||
stdout:
|
||||
description: The stdout stream of the package process.
|
||||
returned: failure during install or uninstall
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
shippable/windows/group1
|
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
|
||||
msi_url: https://ansible-ci-files.s3.amazonaws.com/test/integration/roles/test_win_msi/7z922-x64.msi
|
||||
msi_download_path: "C:\\Program Files\\7z922-x64.msi"
|
||||
msi_install_path: "C:\\Program Files\\7-Zip"
|
||||
msi_product_code: "{23170F69-40C1-2702-0922-000001000000}"
|
|
@ -1,70 +0,0 @@
|
|||
# test code for the win_msi module
|
||||
# (c) 2014, Chris Church <chris@ninemoreminutes.com>
|
||||
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: use win_get_url module to download msi
|
||||
win_get_url:
|
||||
url: "{{msi_url}}"
|
||||
dest: "{{msi_download_path}}"
|
||||
register: win_get_url_result
|
||||
|
||||
- name: make sure msi is uninstalled
|
||||
win_msi:
|
||||
path: "{{msi_product_code|default(msi_download_path,true)}}"
|
||||
state: absent
|
||||
wait: true
|
||||
ignore_errors: true
|
||||
|
||||
- name: install msi
|
||||
win_msi:
|
||||
path: "{{msi_download_path}}"
|
||||
wait: true
|
||||
register: win_msi_install_result
|
||||
|
||||
- name: check win_msi install result
|
||||
assert:
|
||||
that:
|
||||
- "win_msi_install_result is not failed"
|
||||
- "win_msi_install_result is changed"
|
||||
|
||||
- name: install msi again with creates argument
|
||||
win_msi:
|
||||
path: "{{msi_download_path}}"
|
||||
wait: true
|
||||
creates: "{{msi_install_path}}"
|
||||
register: win_msi_install_again_result
|
||||
|
||||
- name: check win_msi install again result
|
||||
# ignore errors because test/module is unreliable
|
||||
ignore_errors: true
|
||||
assert:
|
||||
that:
|
||||
- "win_msi_install_again_result is not failed"
|
||||
- "win_msi_install_again_result is not changed"
|
||||
|
||||
- name: uninstall msi
|
||||
win_msi:
|
||||
path: "{{msi_download_path}}"
|
||||
wait: true
|
||||
state: absent
|
||||
register: win_msi_uninstall_result
|
||||
|
||||
- name: check win_msi uninstall result
|
||||
assert:
|
||||
that:
|
||||
- "win_msi_uninstall_result is not failed"
|
||||
- "win_msi_uninstall_result is changed"
|
Loading…
Reference in a new issue