From 5a0243dd9cb1f2717e0bcf02edf4311979e5aec5 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Mon, 4 May 2026 11:11:27 -0400 Subject: [PATCH] 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) --- .../Shopfloor/00-PreInstall-MachineApps.ps1 | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/playbook/shopfloor-setup/Shopfloor/00-PreInstall-MachineApps.ps1 b/playbook/shopfloor-setup/Shopfloor/00-PreInstall-MachineApps.ps1 index baab2c7..079c85c 100644 --- a/playbook/shopfloor-setup/Shopfloor/00-PreInstall-MachineApps.ps1 +++ b/playbook/shopfloor-setup/Shopfloor/00-PreInstall-MachineApps.ps1 @@ -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++