working name of pod on start and stop

Signed-off-by: jkwiatko <jkwiatkoski@protonmail.com>
This commit is contained in:
jkwiatko
2024-05-24 12:39:32 -04:00
parent e53b96cb25
commit b45364254f
9 changed files with 242 additions and 237 deletions

View File

@ -177,7 +177,10 @@ func PodStop(w http.ResponseWriter, r *http.Request) {
}
}
report := entities.PodStopReport{Id: pod.ID()}
report := entities.PodStopReport{
Id: pod.ID(),
RawInput: pod.Name(),
}
for id, err := range responses {
report.Errs = append(report.Errs, fmt.Errorf("stopping container %s: %w", id, err))
}
@ -213,7 +216,15 @@ func PodStart(w http.ResponseWriter, r *http.Request) {
return
}
report := entities.PodStartReport{Id: pod.ID()}
cfg, err := pod.Config()
if err != nil {
utils.Error(w, http.StatusConflict, err)
return
}
report := entities.PodStartReport{
Id: pod.ID(),
RawInput: cfg.Name,
}
for id, err := range responses {
report.Errs = append(report.Errs, fmt.Errorf("%v: %w", "starting container "+id, err))
}
@ -559,14 +570,13 @@ func PodStats(w http.ResponseWriter, r *http.Request) {
return
}
var flush = func() {}
flush := func() {}
if flusher, ok := w.(http.Flusher); ok {
flush = flusher.Flush
}
// Collect the stats and send them over the wire.
containerEngine := abi.ContainerEngine{Libpod: runtime}
reports, err := containerEngine.PodStats(r.Context(), query.NamesOrIDs, options)
// Error checks as documented in swagger.
if err != nil {
if errors.Is(err, define.ErrNoSuchPod) {