Remove usage of global var log_path for win_domain_* modules (#57092)

* Remove usage of global var log_path

* Add changelog and edit ignore.txt

* win_pagefile: not using testPath

* Revert "win_pagefile: not using testPath"

This reverts commit c8bc10234048257414454905e1c860a8f57a3b3f.

* PSLint error

* Update win_domain_membership.ps1

* Update win_domain_controller.ps1
This commit is contained in:
ShachafGoldstein 2019-06-11 22:31:19 +03:00 committed by Jordan Borean
parent d2909d5ef0
commit 7880be240f
4 changed files with 3 additions and 12 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "Fix PSLint errors regarding global vars (PSAvoidGlobalVars)"

View file

@ -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)) {

View file

@ -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 }

View file

@ -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