Merge pull request #15799 from mheon/fix_2126697

Ensure that a broken OCI spec does not break inspect
This commit is contained in:
OpenShift Merge Robot
2022-09-14 21:55:13 +02:00
committed by GitHub

View File

@ -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