Retain only reportable operation details
This commit is contained in:
@@ -7,6 +7,23 @@ import (
|
||||
"gitea.maximumdirect.net/eric/audita/v3/internal/framework/outcomes"
|
||||
)
|
||||
|
||||
// reportOperations selects report detail after counting and application
|
||||
// attribution. Use a new slice so discarded operations can be released.
|
||||
func reportOperations(operations []outcomes.Operation) []outcomes.Operation {
|
||||
var report []outcomes.Operation
|
||||
for _, operation := range operations {
|
||||
if operation.FailureClass != outcomes.FailureRecoverable {
|
||||
if !operation.Succeeded || len(operation.RecoveryReasons) == 0 {
|
||||
continue
|
||||
}
|
||||
operation.ProposalIndices = nil
|
||||
}
|
||||
operation.Cause = nil
|
||||
report = append(report, operation)
|
||||
}
|
||||
return report
|
||||
}
|
||||
|
||||
func newWorkUnit(spec contracts.ModuleRunSpec, section contracts.SectionMetadata, moduleIndex int) WorkUnitOutcome {
|
||||
return WorkUnitOutcome{
|
||||
ModuleIndex: moduleIndex, StageIndex: spec.Index, StageID: spec.ID, ModuleKey: spec.ModuleKey,
|
||||
|
||||
Reference in New Issue
Block a user