mirror of
https://github.com/containers/podman.git
synced 2025-08-23 09:18:19 +08:00
fix podman container exists and diff for storage containers
Current these commands only check if a container exists in libpod. With this fix, the commands will also check if they are in containers/storage. This allows users to look at differences within a buildah or CRI-O container. Currently buildah diff does not exists, so this helps out in that situation as well as in CRI-O since the cri does not implement a diff command. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -62,18 +62,22 @@ func (r *Runtime) ApplyDiffTarStream(to string, diff io.Reader) error {
|
||||
func (r *Runtime) getLayerID(id string) (string, error) {
|
||||
var toLayer string
|
||||
toImage, err := r.imageRuntime.NewFromLocal(id)
|
||||
if err == nil {
|
||||
return toImage.TopLayer(), nil
|
||||
}
|
||||
|
||||
targetID, err := r.store.Lookup(id)
|
||||
if err != nil {
|
||||
toCtr, err := r.store.Container(id)
|
||||
targetID = id
|
||||
}
|
||||
toCtr, err := r.store.Container(targetID)
|
||||
if err != nil {
|
||||
toLayer, err = layers.FullID(r.store, targetID)
|
||||
if err != nil {
|
||||
toLayer, err = layers.FullID(r.store, id)
|
||||
if err != nil {
|
||||
return "", errors.Errorf("layer, image, or container %s does not exist", id)
|
||||
}
|
||||
} else {
|
||||
toLayer = toCtr.LayerID
|
||||
return "", errors.Errorf("layer, image, or container %s does not exist", id)
|
||||
}
|
||||
} else {
|
||||
toLayer = toImage.TopLayer()
|
||||
toLayer = toCtr.LayerID
|
||||
}
|
||||
return toLayer, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user