Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
main: return different exit code when an input is not found
This is a proof of concept that shows how we could do a different exit code in skopeo 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). Note that this POC is not ideal: 1. lacks tests (happy to do them if there is a chance this is considered) 2. The output breaks, it used to start with `FATA[000]` and now starts with `ERRO[0000]` It's likely that (2) is a show stopper, it seems there is no way to override the exit code of logrus for logrus.Fatal() so it would require a bit more work if the output must stay identical. I picked exit code (2) for not found because it is also the value of ENOENT but that is arbitrary and I'm happy to switch to any other value (we could do `44` as `404` :-) - happy about ideas). P.S. I also found that for local images that are not found `ErrNotAnImage` is returned so the docstring of `storage.ErrNotAnImage` may need updating (I'm happy to do this separtely if desired). To reproduce: ``` $ skopeo inspect containers-storage:010101010101 FATA[0000] Error parsing image name "containers-storage:010101010101": reference "[overlay@/media/space/home/egon/.local/share/containers/storage+/run/user/1000/containers]docker.io/library/010101010101:latest" does not resolve to an image ID: identifier is not an image ``` For references (from storage/errors.go): ``` ErrNotAnImage = errors.New("identifier is not an image") ErrImageUnknown = errors.New("image not known") ``` Signed-off-by: Michael Vogt <[email protected]>
- Loading branch information