00-PreInstall-MachineApps: PCTypes filter alias-aware
Pairs with the rename reorg's other alias maps (Install-FromManifest, GE-Enforce, Get-PCProfile, verify-state). Fleet PCs whose pc-type.txt becomes a new gea-shopfloor-* string still match legacy preinstall.json PCTypes filters like ["Standard"], ["CMM"]. Same map shape as the others - extract to a shared lib later if drift becomes a problem. Without this, a freshly-imaged PC writing pc-type.txt = gea-shopfloor-collections would skip every preinstall.json entry whose PCTypes is Standard/CMM/etc - imaging chain installs nothing past common apps with PCTypes=*. Deployed to PXE server at /srv/samba/enrollment/shopfloor-setup/Shopfloor/ 2026-05-04 alongside the rest of the renamed shopfloor-setup tree. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -300,9 +300,44 @@ foreach ($app in $config.Applications) {
|
||||
|
||||
Write-PreInstallLog "==> $($app.Name)"
|
||||
|
||||
# Filter by PCTypes - matches on wildcard, base type, or composite type-subtype key
|
||||
# Filter by PCTypes - matches on wildcard, base type, composite type-subtype
|
||||
# key, OR any alias-equivalent name. The 2026-05-04 rename reorg gave us
|
||||
# gea-shopfloor-* PC type strings that need to match legacy ["Standard"],
|
||||
# ["CMM"], etc filters in preinstall.json (and vice versa: a future
|
||||
# preinstall.json that uses gea-shopfloor-* should still match a fleet PC
|
||||
# whose pc-type.txt is still "Standard").
|
||||
$allowedTypes = @($app.PCTypes)
|
||||
$matchesType = ($allowedTypes -contains "*") -or ($allowedTypes -contains $pcType) -or ($pcProfileKey -ne $pcType -and $allowedTypes -contains $pcProfileKey)
|
||||
$aliasGroups = @(
|
||||
@('Standard', 'Standard-Machine','Standard-Timeclock','gea-shopfloor-collections','gea-shopfloor-nocollections','gea-shopfloor-common'),
|
||||
@('Standard-Machine', 'gea-shopfloor-collections','gea-shopfloor-nocollections'),
|
||||
@('Standard-Timeclock', 'gea-shopfloor-common'),
|
||||
@('CMM', 'gea-shopfloor-cmm'),
|
||||
@('Keyence', 'gea-shopfloor-keyence'),
|
||||
@('Lab', 'gea-shopfloor-common'),
|
||||
@('WaxAndTrace', 'gea-shopfloor-waxtrace'),
|
||||
@('Genspect', 'gea-shopfloor-genspect'),
|
||||
@('Display', 'gea-shopfloor-display'),
|
||||
@('Heattreat', 'gea-shopfloor-heattreat')
|
||||
)
|
||||
$myNames = New-Object System.Collections.Generic.HashSet[string]([System.StringComparer]::OrdinalIgnoreCase)
|
||||
foreach ($n in @($pcType, $pcProfileKey) | Where-Object { $_ }) {
|
||||
[void]$myNames.Add($n)
|
||||
foreach ($g in $aliasGroups) {
|
||||
if ($g -icontains $n) { foreach ($x in $g) { [void]$myNames.Add($x) } }
|
||||
}
|
||||
}
|
||||
$matchesType = ($allowedTypes -contains '*')
|
||||
if (-not $matchesType) {
|
||||
foreach ($t in $allowedTypes) {
|
||||
if ($myNames.Contains($t)) { $matchesType = $true; break }
|
||||
foreach ($g in $aliasGroups) {
|
||||
if ($g -icontains $t) {
|
||||
foreach ($x in $g) { if ($myNames.Contains($x)) { $matchesType = $true; break } }
|
||||
}
|
||||
if ($matchesType) { break }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (-not $matchesType) {
|
||||
Write-PreInstallLog " PCTypes filter excludes '$pcProfileKey' (allowed: $($allowedTypes -join ', ')) - skipping"
|
||||
$skipped++
|
||||
|
||||
Reference in New Issue
Block a user