Removed deprecated Windows items slated for removed in 2.7 (#43231)

This commit is contained in:
Jordan Borean 2018-07-25 12:02:49 +10:00 committed by GitHub
commit 2c9cbae3f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 472 deletions

View file

@ -62,18 +62,6 @@ $start_when_available = Get-AnsibleParam -obj $params -name "start_when_availabl
$stop_if_going_on_batteries = Get-AnsibleParam -obj $params -name "stop_if_going_on_batteries" -type "bool"
$wake_to_run = Get-AnsibleParam -obj $params -name "wake_to_run" -type "bool"
# deprecated action arguments - use actions instead
$old_arguments = Get-AnsibleParam -obj $params -name "arguments" -type "str" -aliases "argument"
$old_executable = Get-AnsibleParam -obj $params -name "executable" -type "path" -failifempty ($old_arguments -ne $null) -aliases "execute"
# deprecated principal arguments - use logon_type instead
$store_password = Get-AnsibleParam -obj $params -name "store_password" -type "bool"
# deprecated trigger arguments - use triggers instead
$old_days_of_week = Get-AnsibleParam -obj $params -name "days_of_week" -type "list"
$old_frequency = Get-AnsibleParam -obj $params -name "frequency" -type "str"
$old_time = Get-AnsibleParam -obj $params -name "time" -type "str"
$result = @{
changed = $false
}
@ -707,35 +695,11 @@ if ($group) {
$group_sid = Convert-ToSID -account_name $group
}
# Convert the older arguments to the newer format if required
if ($old_executable -ne $null) {
Add-DeprecationWarning -obj $result -message "executable option is deprecated, please use the actions list option instead" -version 2.7
if ($actions -ne $null) {
Fail-Json -obj $result -message "actions and executable are mutually exclusive, use actions by itself instead"
}
$new_action = @{ path = $old_executable }
if ($old_arguments -ne $null) {
Add-DeprecationWarning -obj $result -message "arguments option is deprecated, please use the actions list option instead" -version 2.7
$new_action.arguments = $old_arguments
}
$actions = @($new_action)
}
# validate store_password and logon_type
if ($logon_type -ne $null) {
$full_enum_name = "TASK_LOGON_$($logon_type.ToUpper())"
$logon_type = [TASK_LOGON_TYPE]::$full_enum_name
}
if ($store_password -ne $null) {
Add-DeprecationWarning -obj $result -message "store_password option is deprecated, please use logon_type: password instead" -version 2.7
if ($logon_type -ne $null) {
Fail-Json -obj $result -message "logon_type and store_password are mutually exclusive, use logon_type=password instead"
}
if ($store_password -eq $true -and $password -ne $null) {
$logon_type = [TASK_LOGON_TYPE]::TASK_LOGON_PASSWORD
}
}
# now validate the logon_type option with the other parameters
if ($username -ne $null -and $group -ne $null) {
@ -778,47 +742,6 @@ for ($i = 0; $i -lt $actions.Count; $i++) {
$actions[$i] = $action
}
# convert deprecated trigger args to new format
$deprecated_trigger = $null
if ($old_frequency -ne $null) {
# once, daily, weekly
Add-DeprecationWarning -obj $result -message "" -version 2.7
if ($triggers.Count -eq 0) {
$deprecated_trigger = @{type = $null}
switch ($frequency) {
once { $deprecated_trigger.type = [TASK_TRIGGER_TYPE2]::TASK_TRIGGER_TIME }
daily { $deprecated_trigger.type = [TASK_TRIGGER_TYPE2]::TASK_TRIGGER_DAILY }
weekly { $deprecated_trigger.type = [TASK_TRIGGER_TYPE2]::TASK_TRIGGER_WEEKLY }
}
} else {
Add-Warning -obj $result -message "the trigger list is already specified, ignoring the frequency option as it is deprecated"
}
}
if ($old_days_of_week -ne $null) {
Add-DeprecationWarning -obj $result -message "days_of_week is deprecated, use the triggers list with 'monthlydow' type" -version 2.7
if ($triggers.Count -eq 0) {
$deprecated_trigger.days_of_week = $old_days_of_week
} else {
Add-Warning -obj $result -message "the trigger list is already specified, ignoring the days_of_week option as it is deprecated"
}
}
if ($old_time -ne $null) {
Add-DeprecationWarning -obj $result -message "old_time is deprecated, use the triggers list to specify the 'start_boundary'" -version 2.7
if ($triggers.Count -eq 0) {
try {
$old_time_cast = [datetime]$old_time
} catch [System.InvalidCastException] {
Fail-Json -obj $result -message "failed to convert time '$old_time' to the DateTime format"
}
$deprecated_trigger.start_boundary = ($old_time_cast | Get-Date -Format s)
} else {
Add-Warning -obj $result -message "the trigger list is already specified, ignoring the time option as it is deprecated"
}
}
if ($deprecated_trigger -ne $null) {
$triggers += $deprecated_trgger
}
# convert and validate the triggers - and convert PSCustomObject to Hashtable
for ($i = 0; $i -lt $triggers.Count; $i++) {
$trigger = ConvertTo-HashtableFromPsCustomObject -object $triggers[$i]

View file

@ -66,20 +66,6 @@ options:
description:
- The working directory to run the executable from.
version_added: '2.5'
arguments:
description:
- Arguments to provide for a scheduled task action.
- DEPRECATED since 2.5, use the C(actions) option instead to specify a list
of actions to run.
- Will be removed in 2.7.
aliases: [ argument ]
executable:
description:
- The path to the executable to run for a scheduled task action.
- DEPRECATED since 2.5, use the C(actions) option instead to specify a list
of actions to run.
- Will be removed in 2.7.
type: path
# Trigger options
triggers:
@ -204,28 +190,6 @@ options:
- C(interval) is the amount of time between earch restart of the task and is written in the ISO 8601 Duration format C(P[n]Y[n]M[n]DT[n]H[n]M[n]S).
- C(stop_at_duration_end) is a boolean value that indicates if a running instance of the task is stopped at the end of the repetition pattern.
version_added: '2.5'
days_of_week:
description:
- Days of the week to run a weekly task.
- Specify a list or comma separate days in the full version, e.g. monday
instead of mon.
- DEPRECATED since 2.5, use the C(triggers) option list with the type of
C(monthlydow) or C(weekly).
- Will be removed in 2.7.
type: list
frequency:
description:
- The frequency of the task to run.
- DEPRECATED since 2.5, use the C(triggers) option list and specify the
type based on the frequency required.
- Will be removed in 2.7.
choices: [ daily, once, weekly ]
time:
description:
- The start time to execute the scheduled task.
- DEPRECATED since 2.5, use the C(triggers) option list and use the
C(start_boundary) option to set the start time.
- Will be removed in 2.7.
# Principal options
display_name:
@ -282,16 +246,6 @@ options:
type: bool
default: 'yes'
version_added: '2.5'
store_password:
description:
- Whether to store the password for the user running the task.
- If C(no), the task will only have access to local resources.
- DEPRECATED since 2.5, use C(logon_type=password) to set whether to store
the password for the task.
- Will be removed in 2.7.
type: bool
default: 'yes'
version_added: '2.4'
# RegistrationInfo options
author:

View file

@ -32,7 +32,6 @@ $maximum_redirection = Get-AnsibleParam -obj $params -name "maximum_redirection"
$return_content = Get-AnsibleParam -obj $params -name "return_content" -type "bool" -default $false
$status_code = Get-AnsibleParam -obj $params -name "status_code" -type "list" -default @(200)
$timeout = Get-AnsibleParam -obj $params -name "timeout" -type "int" -default 30
$use_basic_parsing = Get-AnsibleParam -obj $params -name "use_basic_parsing" -type "bool"
$validate_certs = Get-AnsibleParam -obj $params -name "validate_certs" -type "bool" -default $true
$client_cert = Get-AnsibleParam -obj $params -name "client_cert" -type "path"
$client_cert_password = Get-AnsibleParam -obj $params -name "client_cert_password" -type "str"
@ -52,10 +51,6 @@ if ($removes -and -not (Test-AnsiblePath -Path $removes)) {
Exit-Json -obj $result -message "The 'removes' file or directory ($removes) does not exist."
}
if ($use_basic_parsing) {
Add-DeprecationWarning -obj $result -message "Since Ansible 2.5, use_basic_parsing does not change any behaviour, this option will be removed" -version 2.7
}
if ($status_code) {
$status_code = foreach ($code in $status_code) {
try {

View file

@ -61,17 +61,6 @@ options:
description:
- Extra headers to set on the request, see the examples for more details on
how to set this.
use_basic_parsing:
description:
- As of Ansible 2.5, this option is no longer valid and cannot be changed from C(yes), this option will be removed
in Ansible 2.7.
- Before Ansible 2.5, this module relies upon 'Invoke-WebRequest', which by default uses the Internet Explorer Engine
to parse a webpage.
- There's an edge-case where if a user hasn't run IE before, this will fail.
- The only advantage to using the Internet Explorer praser is that you can traverse the DOM in a powershell script.
- That isn't useful for Ansible, so by default we toggle 'UseBasicParsing'. However, you can toggle that off here.
type: bool
default: 'yes'
creates:
description:
- A filename, when it already exists, this step will be skipped.