mirror of
https://github.com/containers/skopeo.git
synced 2025-09-02 23:26:29 +00:00
main: return exit code 2
when an input is not found
This commit makes skopeo return a different exit code when an input is not found. The use case is `osbuild` which uses skopeo to inspect images and it would be nice to differenciate between an image that is not found and general skopeo errors (or errors like network issues etc). I picked exit code `2` for `not found` because it is also the value of `ENOENT`. Man page and a test are added. Signed-off-by: Michael Vogt <mvogt@redhat.com>
This commit is contained in:
committed by
Michael Vogt
parent
d5ac962b5e
commit
16b6f0ade5
@@ -129,4 +129,11 @@ END_EXPECT
|
||||
expect_output --from="$repo_tags" "" "inspect --no-tags was expected to return empty RepoTags[]"
|
||||
}
|
||||
|
||||
@test "inspect: image unknown" {
|
||||
# non existing image
|
||||
run_skopeo 2 inspect containers-storage:non-existing-tag
|
||||
expect_output --substring "identifier is not an image" \
|
||||
"skopeo inspect containers-storage:010101010101"
|
||||
}
|
||||
|
||||
# vim: filetype=sh
|
||||
|
@@ -40,7 +40,7 @@ function setup() {
|
||||
expect_output --substring "authentication required"
|
||||
|
||||
# Correct creds, but no such image
|
||||
run_skopeo 1 inspect --tls-verify=false --creds=$testuser:$testpassword \
|
||||
run_skopeo 2 inspect --tls-verify=false --creds=$testuser:$testpassword \
|
||||
docker://localhost:5000/nonesuch
|
||||
expect_output --substring "manifest unknown"
|
||||
|
||||
|
@@ -24,7 +24,7 @@ function setup() {
|
||||
run_skopeo delete --tls-verify=false $localimg
|
||||
|
||||
# make sure image is removed from registry
|
||||
expected_rc=1
|
||||
expected_rc=2
|
||||
run_skopeo $expected_rc inspect --tls-verify=false $localimg
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user