diff --git a/changelogs/fragments/57092-PSLint-fixes-globalvars.yml b/changelogs/fragments/57092-PSLint-fixes-globalvars.yml new file mode 100644 index 00000000000..584fc3e6fe2 --- /dev/null +++ b/changelogs/fragments/57092-PSLint-fixes-globalvars.yml @@ -0,0 +1,2 @@ +bugfixes: +- "Fix PSLint errors regarding global vars (PSAvoidGlobalVars)" \ No newline at end of file diff --git a/lib/ansible/modules/windows/win_domain_controller.ps1 b/lib/ansible/modules/windows/win_domain_controller.ps1 index fc32c86d766..128e1213920 100644 --- a/lib/ansible/modules/windows/win_domain_controller.ps1 +++ b/lib/ansible/modules/windows/win_domain_controller.ps1 @@ -10,8 +10,6 @@ Set-StrictMode -Version 2 $ErrorActionPreference = "Stop" $ConfirmPreference = "None" -$log_path = $null - Function Write-DebugLog { Param( [string]$msg @@ -111,8 +109,6 @@ $state = Get-AnsibleParam -obj $params -name "state" -validateset ("domain_contr $log_path = Get-AnsibleParam -obj $params -name "log_path" $_ansible_check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -default $false -$global:log_path = $log_path - Try { # ensure target OS support; < 2012 doesn't have cmdlet support for DC promotion If(-not (Get-Command Install-WindowsFeature -ErrorAction SilentlyContinue)) { diff --git a/lib/ansible/modules/windows/win_domain_membership.ps1 b/lib/ansible/modules/windows/win_domain_membership.ps1 index 57d20ae392a..b1e40d20211 100644 --- a/lib/ansible/modules/windows/win_domain_membership.ps1 +++ b/lib/ansible/modules/windows/win_domain_membership.ps1 @@ -9,8 +9,6 @@ Set-StrictMode -Version 2 $ErrorActionPreference = "Stop" -$log_path = $null - Function Write-DebugLog { Param( [string]$msg @@ -213,9 +211,6 @@ Else { # workgroup } } - -$global:log_path = $log_path - Try { $hostname_match = If($hostname) { Get-HostnameMatch $hostname } Else { $true } diff --git a/test/sanity/pslint/ignore.txt b/test/sanity/pslint/ignore.txt index 6513a050b01..7cf655f6501 100644 --- a/test/sanity/pslint/ignore.txt +++ b/test/sanity/pslint/ignore.txt @@ -48,14 +48,12 @@ lib/ansible/modules/windows/win_dns_client.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_dns_client.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_domain.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_domain.ps1 PSUseApprovedVerbs -lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidGlobalVars lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidTrailingWhitespace lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_domain_controller.ps1 PSCustomUseLiteralPath lib/ansible/modules/windows/win_domain_controller.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_domain_controller.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_domain_group.ps1 PSAvoidTrailingWhitespace -lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidGlobalVars lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidTrailingWhitespace lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_domain_membership.ps1 PSCustomUseLiteralPath @@ -175,4 +173,4 @@ test/integration/targets/win_script/files/test_script_with_args.ps1 PSAvoidUsing test/integration/targets/win_script/files/test_script_with_splatting.ps1 PSAvoidUsingWriteHost test/integration/targets/win_stat/library/test_symlink_file.ps1 PSCustomUseLiteralPath test/integration/targets/win_user_right/library/test_get_right.ps1 PSCustomUseLiteralPath -test/runner/setup/windows-httptester.ps1 PSCustomUseLiteralPath +test/runner/setup/windows-httptester.ps1 PSCustomUseLiteralPath \ No newline at end of file