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 <sonoda.toshiki@fujitsu.com>
This commit is contained in:
Toshiki Sonoda 2022-11-17 11:11:38 +09:00
parent 0253d3cca2
commit 607cd39e15
4 changed files with 6 additions and 5 deletions

View File

@ -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
}

View File

@ -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"`
}

View File

@ -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 {

View File

@ -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])
}
}