Private/Set-KadenJournalOperatorModelRepair.ps1
|
function Set-KadenJournalOperatorModelRepair { <# .SYNOPSIS Record whether repair re-ran tuning or preserved it. .DESCRIPTION Writes operatorModelRepair onto a completed transaction journal. Resume records rerun. Restore records preserved. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Private journal update. Repair-KadenRepo owns ShouldProcess.')] [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$JournalPath, [Parameter(Mandatory = $true)] [ValidateSet('rerun', 'preserved')] [string]$Disposition ) $journal = Get-Content -LiteralPath $JournalPath -Raw | ConvertFrom-Json $updated = [ordered]@{} foreach ($prop in @($journal.PSObject.Properties)) { $updated[$prop.Name] = $prop.Value } $updated['operatorModelRepair'] = $Disposition Write-KadenJsonAtomic -LiteralPath $JournalPath -Object $updated } |