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
pull/57715/head
ShachafGoldstein 6 years ago committed by Jordan Borean
parent d2909d5ef0
commit 7880be240f

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

@ -10,8 +10,6 @@ Set-StrictMode -Version 2
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
$ConfirmPreference = "None" $ConfirmPreference = "None"
$log_path = $null
Function Write-DebugLog { Function Write-DebugLog {
Param( Param(
[string]$msg [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" $log_path = Get-AnsibleParam -obj $params -name "log_path"
$_ansible_check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -default $false $_ansible_check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -default $false
$global:log_path = $log_path
Try { Try {
# ensure target OS support; < 2012 doesn't have cmdlet support for DC promotion # ensure target OS support; < 2012 doesn't have cmdlet support for DC promotion
If(-not (Get-Command Install-WindowsFeature -ErrorAction SilentlyContinue)) { If(-not (Get-Command Install-WindowsFeature -ErrorAction SilentlyContinue)) {

@ -9,8 +9,6 @@ Set-StrictMode -Version 2
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
$log_path = $null
Function Write-DebugLog { Function Write-DebugLog {
Param( Param(
[string]$msg [string]$msg
@ -213,9 +211,6 @@ Else { # workgroup
} }
} }
$global:log_path = $log_path
Try { Try {
$hostname_match = If($hostname) { Get-HostnameMatch $hostname } Else { $true } $hostname_match = If($hostname) { Get-HostnameMatch $hostname } Else { $true }

@ -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_dns_client.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_domain.ps1 PSAvoidUsingEmptyCatchBlock lib/ansible/modules/windows/win_domain.ps1 PSAvoidUsingEmptyCatchBlock
lib/ansible/modules/windows/win_domain.ps1 PSUseApprovedVerbs 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 PSAvoidTrailingWhitespace
lib/ansible/modules/windows/win_domain_controller.ps1 PSAvoidUsingWMICmdlet 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 PSCustomUseLiteralPath
lib/ansible/modules/windows/win_domain_controller.ps1 PSUseApprovedVerbs lib/ansible/modules/windows/win_domain_controller.ps1 PSUseApprovedVerbs
lib/ansible/modules/windows/win_domain_controller.ps1 PSUseDeclaredVarsMoreThanAssignments lib/ansible/modules/windows/win_domain_controller.ps1 PSUseDeclaredVarsMoreThanAssignments
lib/ansible/modules/windows/win_domain_group.ps1 PSAvoidTrailingWhitespace 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 PSAvoidTrailingWhitespace
lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidUsingWMICmdlet lib/ansible/modules/windows/win_domain_membership.ps1 PSAvoidUsingWMICmdlet
lib/ansible/modules/windows/win_domain_membership.ps1 PSCustomUseLiteralPath lib/ansible/modules/windows/win_domain_membership.ps1 PSCustomUseLiteralPath

Loading…
Cancel
Save