Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated Load-CommandUtils and Import-PrivilegeUtil #77457

Merged
merged 1 commit into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/powershell-deprecated-functions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
removed_features:
- Remove deprecated powershell functions ``Load-CommandUtils`` and ``Import-PrivilegeUtil``
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -98,5 +79,5 @@ Function Set-AnsiblePrivilege {
}
}

Export-ModuleMember -Function Import-PrivilegeUtil, Get-AnsiblePrivilege, Set-AnsiblePrivilege
Export-ModuleMember -Function Get-AnsiblePrivilege, Set-AnsiblePrivilege