When removing objects specifying --force,podman should exit with 0

This Patch will cause podman COMMAND rm --force bogus not fail

This is how Docker works, so Podman should follow this to allow existing
scripts to convert from Docker to Podman.

Fixes: #14612
Oprignal version of this patch came from wufan 1991849113@qq.com

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2022-07-26 06:41:08 -04:00
parent 242639f4b1
commit 75419c5d88
10 changed files with 76 additions and 4 deletions

View File

@@ -317,4 +317,11 @@ Deleted: $pauseID"
is "$output" ""
}
@test "podman image rm --force bogus" {
run_podman 1 image rm bogus
is "$output" "Error: bogus: image not known" "Should print error"
run_podman image rm --force bogus
is "$output" "" "Should print no output"
}
# vim: filetype=sh

View File

@@ -96,4 +96,11 @@ load helpers
run_podman 137 run --name $rand $IMAGE sleep 30
}
@test "podman container rm --force bogus" {
run_podman 1 container rm bogus
is "$output" "Error: no container with name or ID \"bogus\" found: no such container" "Should print error"
run_podman container rm --force bogus
is "$output" "" "Should print no output"
}
# vim: filetype=sh

View File

@@ -473,4 +473,11 @@ EOF
run_podman image rm --force localhost/volume_image
}
@test "podman volume rm --force bogus" {
run_podman 1 volume rm bogus
is "$output" "Error: no volume with name \"bogus\" found: no such volume" "Should print error"
run_podman volume rm --force bogus
is "$output" "" "Should print no output"
}
# vim: filetype=sh

View File

@@ -547,4 +547,11 @@ io.max | $lomajmin rbps=1048576 wbps=1048576 riops=max wiops=max
wait
}
@test "podman pod rm --force bogus" {
run_podman 1 pod rm bogus
is "$output" "Error: .*bogus.*: no such pod" "Should print error"
run_podman pod rm --force bogus
is "$output" "" "Should print no output"
}
# vim: filetype=sh

View File

@@ -260,7 +260,7 @@ load helpers
run_podman rm -t 0 -f $cid
run_podman network rm $mynetname
run_podman 1 network rm -f $mynetname
run_podman 1 network rm $mynetname
}
@test "podman network reload" {
@@ -760,4 +760,11 @@ EOF
done
}
@test "podman network rm --force bogus" {
run_podman 1 network rm bogus
is "$output" "Error: unable to find network with name or ID bogus: network not found" "Should print error"
run_podman network rm --force bogus
is "$output" "" "Should print no output"
}
# vim: filetype=sh