diff --git a/changelogs/fragments/powershell-deprecated-functions.yml b/changelogs/fragments/powershell-deprecated-functions.yml new file mode 100644 index 00000000000..eb810394ffc --- /dev/null +++ b/changelogs/fragments/powershell-deprecated-functions.yml @@ -0,0 +1,2 @@ +removed_features: + - Remove deprecated powershell functions ``Load-CommandUtils`` and ``Import-PrivilegeUtil`` diff --git a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CommandUtil.psm1 b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CommandUtil.psm1 index 24075dd5564..56b5d392857 100644 --- a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CommandUtil.psm1 +++ b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CommandUtil.psm1 @@ -3,25 +3,6 @@ #AnsibleRequires -CSharpUtil Ansible.Process -Function Load-CommandUtils { - <# - .SYNOPSIS - No-op, as the C# types are automatically loaded. - #> - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Cannot change the name now")] - Param() - $msg = "Load-CommandUtils is deprecated and no longer needed, this cmdlet will be removed in a future version" - if ((Get-Command -Name Add-DeprecationWarning -ErrorAction SilentlyContinue) -and (Get-Variable -Name result -ErrorAction SilentlyContinue)) { - Add-DeprecationWarning -obj $result.Value -message $msg -version 2.12 - } - else { - $module = Get-Variable -Name module -ErrorAction SilentlyContinue - if ($null -ne $module -and $module.Value.GetType().FullName -eq "Ansible.Basic.AnsibleModule") { - $module.Value.Deprecate($msg, "2.12") - } - } -} - Function Get-ExecutablePath { <# .SYNOPSIS @@ -123,4 +104,4 @@ Function Run-Command { } # this line must stay at the bottom to ensure all defined module parts are exported -Export-ModuleMember -Function Get-ExecutablePath, Load-CommandUtils, Run-Command +Export-ModuleMember -Function Get-ExecutablePath, Run-Command diff --git a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.PrivilegeUtil.psm1 b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.PrivilegeUtil.psm1 index 2737e8a2ba3..78f0d6467a2 100644 --- a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.PrivilegeUtil.psm1 +++ b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.PrivilegeUtil.psm1 @@ -3,25 +3,6 @@ #AnsibleRequires -CSharpUtil Ansible.Privilege -Function Import-PrivilegeUtil { - <# - .SYNOPSIS - No-op, as the C# types are automatically loaded. - #> - [CmdletBinding()] - Param() - $msg = "Import-PrivilegeUtil is deprecated and no longer needed, this cmdlet will be removed in a future version" - if ((Get-Command -Name Add-DeprecationWarning -ErrorAction SilentlyContinue) -and (Get-Variable -Name result -ErrorAction SilentlyContinue)) { - Add-DeprecationWarning -obj $result.Value -message $msg -version 2.12 - } - else { - $module = Get-Variable -Name module -ErrorAction SilentlyContinue - if ($null -ne $module -and $module.Value.GetType().FullName -eq "Ansible.Basic.AnsibleModule") { - $module.Value.Deprecate($msg, "2.12") - } - } -} - Function Get-AnsiblePrivilege { <# .SYNOPSIS @@ -98,5 +79,5 @@ Function Set-AnsiblePrivilege { } } -Export-ModuleMember -Function Import-PrivilegeUtil, Get-AnsiblePrivilege, Set-AnsiblePrivilege +Export-ModuleMember -Function Get-AnsiblePrivilege, Set-AnsiblePrivilege