windows: removed deprecated features in 2.6 (#38930)

* windows: removed deprecated features in 2.6

* Comma surgery.
This commit is contained in:
Jordan Borean 2018-04-26 06:13:37 +10:00 committed by GitHub
commit f8853d83e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 32 additions and 197 deletions

View file

@ -18,16 +18,10 @@ $check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "b
$name = Get-AnsibleParam -obj $params -name "name" -type "list" -failifempty $true
$state = Get-AnsibleParam -obj $params -name "state" -type "str" -default "present" -validateset "present","absent"
# DEPRECATED 2.4, potential removal in 2.6+
$restart = Get-AnsibleParam -obj $params -name "restart" -type "bool" -default $false
$include_sub_features = Get-AnsibleParam -obj $params -name "include_sub_features" -type "bool" -default $false
$include_management_tools = Get-AnsibleParam -obj $params -name "include_management_tools" -type "bool" -default $false
$source = Get-AnsibleParam -obj $params -name "source" -type "str"
If ($restart) {
Add-DeprecationWarning -obj $result -message "The 'restart' parameter causes instability. Use the 'win_reboot' action conditionally on 'reboot_required' return value instead" -version 2.6
}
$install_cmdlet = $false
if (Get-Command -Name Install-WindowsFeature -ErrorAction SilentlyContinue) {
Set-Alias -Name Install-AnsibleWindowsFeature -Value Install-WindowsFeature
@ -43,8 +37,8 @@ if (Get-Command -Name Install-WindowsFeature -ErrorAction SilentlyContinue) {
if ($state -eq "present") {
$install_args = @{
Name = $name
Restart = $restart
IncludeAllSubFeature = $include_sub_features
Restart = $false
WhatIf = $check_mode
ErrorAction = "Stop"
}
@ -68,7 +62,7 @@ if ($state -eq "present") {
} else {
$uninstall_args = @{
Name = $name
Restart = $restart
Restart = $false
WhatIf = $check_mode
ErrorAction = "Stop"
}
@ -115,7 +109,7 @@ $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, potential removal in 2.6+ (standardize naming to "reboot_required")
# DEPRECATED 2.4, remove in 2.8 (standardize naming to "reboot_required")
$result.restart_needed = $result.reboot_required
Exit-Json -obj $result