mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
Merge pull request #15799 from mheon/fix_2126697
Ensure that a broken OCI spec does not break inspect
This commit is contained in:
@ -356,7 +356,9 @@ func (c *Container) specFromState() (*spec.Spec, error) {
|
|||||||
return nil, fmt.Errorf("reading container config: %w", err)
|
return nil, fmt.Errorf("reading container config: %w", err)
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal(content, &returnSpec); err != nil {
|
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) {
|
} else if !os.IsNotExist(err) {
|
||||||
// ignore when the file does not exist
|
// ignore when the file does not exist
|
||||||
|
Reference in New Issue
Block a user