diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-01 19:18:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-01 19:18:49 +0100 |
commit | bab635d9f6f782dfff7b2d7d573fd170affe2d3f (patch) | |
tree | 914afeec3e6c96f45f03681dc5bb384e38d7f450 | |
parent | b5827d80d39f2a9865d7f6486d63e61d5c9926ef (diff) | |
parent | 3752016338da27e0aca6334a287cb76954ff109c (diff) | |
download | podman-bab635d9f6f782dfff7b2d7d573fd170affe2d3f.tar.gz podman-bab635d9f6f782dfff7b2d7d573fd170affe2d3f.tar.bz2 podman-bab635d9f6f782dfff7b2d7d573fd170affe2d3f.zip |
Merge pull request #9542 from vrothberg/rmi-hardening
podman rmi: handle corrupted storage better
-rw-r--r-- | libpod/image/layer_tree.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libpod/image/layer_tree.go b/libpod/image/layer_tree.go index dde39dba1..aa3084449 100644 --- a/libpod/image/layer_tree.go +++ b/libpod/image/layer_tree.go @@ -4,7 +4,6 @@ import ( "context" ociv1 "github.com/opencontainers/image-spec/specs-go/v1" - "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -188,7 +187,12 @@ func (t *layerTree) parent(ctx context.Context, child *Image) (*Image, error) { node, exists := t.nodes[child.TopLayer()] if !exists { - return nil, errors.Errorf("layer not found in layer tree: %q", child.TopLayer()) + // Note: erroring out in this case has turned out having been a + // mistake. Users may not be able to recover, so we're now + // throwing a warning to guide them to resolve the issue and + // turn the errors non-fatal. + logrus.Warnf("Layer %s not found in layer. The storage may be corrupted, consider running `podman system reset`.", child.TopLayer()) + return nil, nil } childOCI, err := t.toOCI(ctx, child) |