GE-Enforce: alias-aware manifest dir resolution

Phase 2 of the gea-shopfloor-* rename. Pairs with the v2 share manifest
dir renames done in /home/camp/pxe-images/tsgwp00525-v2/ this session
(local-only, syncs to prod separately):

  standard-machine    -> gea-shopfloor-collections
  cmm                 -> gea-shopfloor-cmm
  keyence             -> gea-shopfloor-keyence
  genspect            -> gea-shopfloor-genspect
  waxandtrace         -> gea-shopfloor-waxtrace
  display             -> gea-shopfloor-display
  lab                 -> merged into gea-shopfloor-common
  (new)               -> gea-shopfloor-nocollections (clone of collections w/o UDC)
  (new)               -> gea-shopfloor-heattreat (placeholder)
  (new)               -> gea-shopfloor-common (Timeclock + Lab merge)

GE-Enforce now walks an alias group when the constructed dir name has
no manifest.json. Fleet PCs whose pc-type.txt still says "Standard" /
sub "Machine" continue to find their manifest at the new
gea-shopfloor-collections location, so the rename is invisible to them.
After Phase 4 (startnet.cmd) lands and freshly-imaged PCs write the new
strings directly, the alias resolution still works for both forms.

Smoke-tested on win11 VM as SYSTEM via qga: legacy Standard/Machine
and new gea-shopfloor-collections both reach the same manifest, fire
the same entries, complete cleanly.

Phases 3+4 (repo folder renames + startnet.cmd menu) deferred per
project-shopfloor-rename-reorg memory.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-05-04 07:27:29 -04:00
parent 5fe7e7767f
commit 285d81edc4

View File

@@ -152,6 +152,41 @@ try {
} }
# --- Process manifests in order: common, per-type, per-type+subtype --- # --- Process manifests in order: common, per-type, per-type+subtype ---
# ---- Manifest dir resolution with alias support ---------------
# The 2026-05-03 rename reorg replaced legacy dir names (standard-machine,
# cmm, keyence, ...) with gea-shopfloor-* equivalents on the share. Fleet
# PCs may still write old names to pc-type.txt during transition. Try
# the constructed dir first; if it has no manifest.json, walk the alias
# set and pick the first that does. See project-shopfloor-rename-reorg
# memory note for the full rename plan.
$pcTypeAliasGroups = @(
@('standard', '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')
)
function Resolve-ManifestDir {
param([string]$DirName)
$primary = Join-Path $driveLetter $DirName
if (Test-Path (Join-Path $primary 'manifest.json')) { return $primary }
foreach ($g in $pcTypeAliasGroups) {
if ($g -contains $DirName.ToLower()) {
foreach ($alias in $g) {
if ($alias -ieq $DirName) { continue }
$candidate = Join-Path $driveLetter $alias
if (Test-Path (Join-Path $candidate 'manifest.json')) { return $candidate }
}
}
}
return $null
}
$targets = @() $targets = @()
$commonRoot = Join-Path $driveLetter 'common' $commonRoot = Join-Path $driveLetter 'common'
@@ -164,21 +199,21 @@ try {
$typeDir = $pcType.ToLower() $typeDir = $pcType.ToLower()
if ($typeDir) { if ($typeDir) {
$typeRoot = Join-Path $driveLetter $typeDir $resolvedRoot = Resolve-ManifestDir -DirName $typeDir
$typeManifest = Join-Path $typeRoot 'manifest.json' if ($resolvedRoot) {
if (Test-Path $typeManifest) { $typeManifest = Join-Path $resolvedRoot 'manifest.json'
$targets += [pscustomobject]@{ Label = $pcType; Manifest = $typeManifest; Root = $typeRoot } $targets += [pscustomobject]@{ Label = $pcType; Manifest = $typeManifest; Root = $resolvedRoot }
} else { } else {
Write-EnforceLog "$typeDir\manifest.json not on share - no type-specific apps for $pcType" Write-EnforceLog "$typeDir\manifest.json (or aliases) not on share - no type-specific apps for $pcType"
} }
} }
if ($pcSubType) { if ($pcSubType) {
$stDir = ($pcType + '-' + $pcSubType).ToLower() $stDir = ($pcType + '-' + $pcSubType).ToLower()
$stRoot = Join-Path $driveLetter $stDir $resolvedRoot = Resolve-ManifestDir -DirName $stDir
$stManifest = Join-Path $stRoot 'manifest.json' if ($resolvedRoot) {
if (Test-Path $stManifest) { $stManifest = Join-Path $resolvedRoot 'manifest.json'
$targets += [pscustomobject]@{ Label = "$pcType-$pcSubType"; Manifest = $stManifest; Root = $stRoot } $targets += [pscustomobject]@{ Label = "$pcType-$pcSubType"; Manifest = $stManifest; Root = $resolvedRoot }
} }
} }