CMM: goCMM restore - canonicalize the SHARE segment case, not just the host

goCMM showed an empty parts list after restore though the bay reached the share.
Decompiled goCMM: PartGroupViewModel matches the registry Selected Part Group
against ApplicationSettings.xml <PartGroup FullName> with a CASE-SENSITIVE compare,
then enumerates that FullName for the parts. The host-canon rewrite fixed only the
hostname, leaving xml '\shared' (lowercase) vs registry '\SHARED' (uppercase) ->
Find null -> SelectedPartGroup null -> empty list. Fix spans the share segment too,
pinning both to \tsgwp00525.wjs.geaerospace.net\SHARED. Verified in PowerShell
(-ceq True). Runs at imaging in Restore-CMM, so all captured backups are fixed on
restore with no re-backup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-06-14 13:12:07 -04:00
parent 9145023440
commit d441abd20f

View File

@@ -54,9 +54,18 @@ $DefaultRewrites = @(
# already-correct FQDN maps to itself). Disabled by -NoDefaultRewrite. # already-correct FQDN maps to itself). Disabled by -NoDefaultRewrite.
$PartGroupHostShort = 'tsgwp00525' $PartGroupHostShort = 'tsgwp00525'
$PartGroupHostFqdn = 'tsgwp00525.wjs.geaerospace.net' $PartGroupHostFqdn = 'tsgwp00525.wjs.geaerospace.net'
# \\HOST or \\HOST.any.domain (followed by the next path backslash) -> \\FQDN # \\HOST or \\HOST.any.domain PLUS the \shared share segment (any case) ->
$PartGroupHostRx = '(?i)\\\\' + [regex]::Escape($PartGroupHostShort) + '(?:\.[A-Za-z0-9.\-]+)?(?=\\)' # the exact canonical \\FQDN\SHARED. The share segment case MUST be normalized
$PartGroupHostTo = '\\' + $PartGroupHostFqdn # too, not just the host: goCMM matches the registry 'Selected Part Group'
# against the ApplicationSettings.xml <PartGroup FullName> with a CASE-SENSITIVE
# string compare (PartGroupViewModel: Find(pg => pg.FullName == regValue)). If
# only the host were fixed, the xml kept '\shared' (lowercase, as captured) while
# the override/09-Setup form is '\SHARED' (uppercase) -> Find returns null ->
# SelectedPartGroup null -> goCMM enumerates nothing -> EMPTY parts list even
# though the bay can reach the share. Match the whole host+share span and pin
# both to '\\tsgwp00525.wjs.geaerospace.net\SHARED'. Idempotent.
$PartGroupHostRx = '(?i)\\\\' + [regex]::Escape($PartGroupHostShort) + '(?:\.[A-Za-z0-9.\-]+)?\\shared(?=\\|$)'
$PartGroupHostTo = '\\' + $PartGroupHostFqdn + '\SHARED'
$ErrorActionPreference = 'Continue' $ErrorActionPreference = 'Continue'
$ts = Get-Date -Format 'yyyyMMdd-HHmmss' $ts = Get-Date -Format 'yyyyMMdd-HHmmss'
$logDir = 'C:\Logs\CMM' $logDir = 'C:\Logs\CMM'