mirror of
https://github.com/containers/podman
synced 2024-10-19 08:44:11 +00:00
stop reporting errors removing containers that don't exist
Init containers are removed once they exit, but podman reports and error that the container does not exist, when it was previously removed. Stop reporting missing containers when removing. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
2a48296b0b
commit
4a5581ce0d
|
@ -44,10 +44,6 @@ func (p *Pod) startInitContainers(ctx context.Context) error {
|
|||
icLock.Unlock()
|
||||
return fmt.Errorf("failed to remove once init container %s: %w", initCon.ID(), err)
|
||||
}
|
||||
// Removing a container this way requires an explicit call to clean up the db
|
||||
if err := p.runtime.state.RemoveContainerFromPod(p, initCon); err != nil {
|
||||
logrus.Errorf("Removing container %s from database: %v", initCon.ID(), err)
|
||||
}
|
||||
icLock.Unlock()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ EOF
|
|||
run_podman container inspect --format "{{.HostConfig.NetworkMode}}" $infraID
|
||||
is "$output" "none" "network mode none is set for the container"
|
||||
|
||||
run_podman kube down - < $PODMAN_TMPDIR/test.yaml
|
||||
run_podman kube down $PODMAN_TMPDIR/test.yaml
|
||||
run_podman 125 inspect test_pod-test
|
||||
is "$output" ".*Error: inspecting object: no such object: \"test_pod-test\""
|
||||
run_podman pod rm -a
|
||||
|
@ -436,6 +436,38 @@ status: {}
|
|||
run_podman rm -f -t0 myyaml
|
||||
}
|
||||
|
||||
@test "podman play with init container" {
|
||||
TESTDIR=$PODMAN_TMPDIR/testdir
|
||||
mkdir -p $TESTDIR
|
||||
|
||||
testUserYaml="
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: pod
|
||||
spec:
|
||||
containers:
|
||||
- command:
|
||||
- ls
|
||||
- /dev/shm/test1
|
||||
image: $IMAGE
|
||||
name: testCtr
|
||||
initContainers:
|
||||
- command:
|
||||
- touch
|
||||
- /dev/shm/test1
|
||||
image: $IMAGE
|
||||
name: initCtr
|
||||
"
|
||||
echo "$testUserYaml" > $PODMAN_TMPDIR/test.yaml
|
||||
run_podman kube play $PODMAN_TMPDIR/test.yaml
|
||||
assert "$output" !~ "level=" "init containers should not generate logrus.Error"
|
||||
run_podman inspect --format "{{.State.ExitCode}}" pod-testCtr
|
||||
is "$output" "0" "init container should have created /dev/shm/test1"
|
||||
|
||||
run_podman kube down $PODMAN_TMPDIR/test.yaml
|
||||
}
|
||||
|
||||
@test "podman kube play - hostport" {
|
||||
HOST_PORT=$(random_free_port)
|
||||
echo "
|
||||
|
|
Loading…
Reference in a new issue