From 607cd39e158cc52f254540ee3f761126133f3263 Mon Sep 17 00:00:00 2001 From: Toshiki Sonoda Date: Thu, 17 Nov 2022 11:11:38 +0900 Subject: [PATCH] Removing the RawInput from the API output Including the RawInput in the API output is meaningless. Fixes: #16497 [NO NEW TESTS NEEDED] Signed-off-by: Toshiki Sonoda --- libpod/runtime_ctr.go | 4 ++-- pkg/domain/entities/containers.go | 4 ++-- pkg/domain/entities/reports/containers.go | 2 +- pkg/domain/infra/tunnel/containers.go | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index 37706249fe..db5d3bba36 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -1024,7 +1024,7 @@ func (r *Runtime) RemoveDepend(ctx context.Context, rmCtr *Container, force bool return nil, err } for _, cID := range podContainerIDS { - rmReports = append(rmReports, &reports.RmReport{Id: cID, RawInput: cID}) + rmReports = append(rmReports, &reports.RmReport{Id: cID}) } return rmReports, nil } @@ -1052,7 +1052,7 @@ func (r *Runtime) RemoveDepend(ctx context.Context, rmCtr *Container, force bool rmReports = append(rmReports, reports...) } - report := reports.RmReport{Id: rmCtr.ID(), RawInput: rmCtr.ID()} + report := reports.RmReport{Id: rmCtr.ID()} report.Err = r.removeContainer(ctx, rmCtr, force, removeVolume, false, false, timeout) return append(rmReports, &report), nil } diff --git a/pkg/domain/entities/containers.go b/pkg/domain/entities/containers.go index 47225f25c5..6e17ddf533 100644 --- a/pkg/domain/entities/containers.go +++ b/pkg/domain/entities/containers.go @@ -204,7 +204,7 @@ type CheckpointOptions struct { type CheckpointReport struct { Err error `json:"-"` Id string `json:"Id"` //nolint:revive,stylecheck - RawInput string `json:"RawInput"` + RawInput string `json:"-"` RuntimeDuration int64 `json:"runtime_checkpoint_duration"` CRIUStatistics *define.CRIUCheckpointRestoreStatistics `json:"criu_statistics"` } @@ -231,7 +231,7 @@ type RestoreOptions struct { type RestoreReport struct { Err error `json:"-"` Id string `json:"Id"` //nolint:revive,stylecheck - RawInput string `json:"RawInput"` + RawInput string `json:"-"` RuntimeDuration int64 `json:"runtime_restore_duration"` CRIUStatistics *define.CRIUCheckpointRestoreStatistics `json:"criu_statistics"` } diff --git a/pkg/domain/entities/reports/containers.go b/pkg/domain/entities/reports/containers.go index 6759fc4020..6ccbc9a623 100644 --- a/pkg/domain/entities/reports/containers.go +++ b/pkg/domain/entities/reports/containers.go @@ -3,7 +3,7 @@ package reports type RmReport struct { Id string `json:"Id"` //nolint:revive,stylecheck Err error `json:"Err,omitempty"` - RawInput string + RawInput string `json:"-"` } func RmReportsIds(r []*RmReport) []string { diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index a49048ce6c..f3e66982d8 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -273,6 +273,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string, } for i := range newReports { alreadyRemoved[newReports[i].Id] = true + newReports[i].RawInput = idToRawInput[newReports[i].Id] rmReports = append(rmReports, newReports[i]) } }