Merge pull request #19549 from rhatdan/quadlet

podman stop --cidfile missing --ignore
This commit is contained in:
OpenShift Merge Robot
2023-08-09 07:50:19 -04:00
committed by GitHub
4 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package containers
import (
"context"
"errors"
"fmt"
"os"
"strings"
@ -110,6 +111,9 @@ func stop(cmd *cobra.Command, args []string) error {
for _, cidFile := range stopCidFiles {
content, err := os.ReadFile(cidFile)
if err != nil {
if stopOptions.Ignore && errors.Is(err, os.ErrNotExist) {
continue
}
return fmt.Errorf("reading CIDFile: %w", err)
}
id := strings.Split(string(content), "\n")[0]

View File

@ -20,6 +20,8 @@ Remove all containers. Can be used in conjunction with **-f** as well.
@@option cidfile.read
Command does not fail when *file* is missing and user specified --ignore.
#### **--depend**
Remove selected container and recursively remove all containers that depend on it.

View File

@ -23,6 +23,8 @@ Stop all running containers. This does not include paused containers.
@@option cidfile.read
Command does not fail when *file* is missing and user specified --ignore.
#### **--filter**, **-f**=*filter*
Filter what containers are going to be stopped.

View File

@ -85,6 +85,13 @@ load helpers
run_podman stop --ignore $name
is "$output" "" "podman stop nonexistent container, with --ignore"
nosuchfile=$PODMAN_TMPDIR/no-such-file
run_podman 125 stop --cidfile=$nosuchfile
is "$output" "Error: reading CIDFile: open $nosuchfile: no such file or directory" "podman stop with missing cidfile, without --ignore"
run_podman stop --cidfile=$nosuchfile --ignore
is "$output" "" "podman stop with missing cidfile, with --ignore"
}