setup.ps1 - parity with linux regarding missing local facts path (#58887)
* setup.ps1 - parity with linux regarding missing local facts path * add warning * Update setup.ps1-parity-with-linux-regarding-missing-local-facts-path.yml
This commit is contained in:
parent
d2e1aeeb67
commit
e74d397c01
2 changed files with 12 additions and 8 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- "setup.ps1 - parity with linux regarding missing local facts path (https://github.com/ansible/ansible/issues/57974)"
|
|
@ -12,10 +12,7 @@ Function Get-CustomFacts {
|
||||||
$factpath = $null
|
$factpath = $null
|
||||||
)
|
)
|
||||||
|
|
||||||
if (-not (Test-Path -Path $factpath)) {
|
if (Test-Path -Path $factpath) {
|
||||||
Fail-Json $result "The path $factpath does not exist. Typo?"
|
|
||||||
}
|
|
||||||
|
|
||||||
$FactsFiles = Get-ChildItem -Path $factpath | Where-Object -FilterScript {($PSItem.PSIsContainer -eq $false) -and ($PSItem.Extension -eq '.ps1')}
|
$FactsFiles = Get-ChildItem -Path $factpath | Where-Object -FilterScript {($PSItem.PSIsContainer -eq $false) -and ($PSItem.Extension -eq '.ps1')}
|
||||||
|
|
||||||
foreach ($FactsFile in $FactsFiles) {
|
foreach ($FactsFile in $FactsFiles) {
|
||||||
|
@ -23,6 +20,11 @@ Function Get-CustomFacts {
|
||||||
$result.ansible_facts.Add("ansible_$(($FactsFile.Name).Split('.')[0])", $out)
|
$result.ansible_facts.Add("ansible_$(($FactsFile.Name).Split('.')[0])", $out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Add-Warning $result "Non existing path was set for local facts - $factpath"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Function Get-MachineSid {
|
Function Get-MachineSid {
|
||||||
# The Machine SID is stored in HKLM:\SECURITY\SAM\Domains\Account and is
|
# The Machine SID is stored in HKLM:\SECURITY\SAM\Domains\Account and is
|
||||||
|
|
Loading…
Reference in a new issue