aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-14 21:55:13 +0200
committerGitHub <noreply@github.com>2022-09-14 21:55:13 +0200
commit4fc18d07a6b206476421ed134f0eeec1221936c2 (patch)
tree1ee505e9506b5ead4bf4c3eb0614df72f55057e3
parentbb4872e2f6602950f5852c34e95444acc3623f21 (diff)
parent42937cd9a8f81550dd83b799fc6d0d4c7a1bba69 (diff)
downloadpodman-4fc18d07a6b206476421ed134f0eeec1221936c2.tar.gz
podman-4fc18d07a6b206476421ed134f0eeec1221936c2.tar.bz2
podman-4fc18d07a6b206476421ed134f0eeec1221936c2.zip
Merge pull request #15799 from mheon/fix_2126697
Ensure that a broken OCI spec does not break inspect
-rw-r--r--libpod/container.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpod/container.go b/libpod/container.go
index bdedafd22..cfffd8ea1 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -356,7 +356,9 @@ func (c *Container) specFromState() (*spec.Spec, error) {
return nil, fmt.Errorf("reading container config: %w", err)
}
if err := json.Unmarshal(content, &returnSpec); err != nil {
- return nil, fmt.Errorf("unmarshalling container config: %w", err)
+ // Malformed spec, just use c.config.Spec instead
+ logrus.Warnf("Error unmarshalling container %s config: %v", c.ID(), err)
+ return c.config.Spec, nil
}
} else if !os.IsNotExist(err) {
// ignore when the file does not exist