mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-23 15:23:28 +00:00
Clear snapshot when container doesn't exist
This clears up a scenario where a container can be deleted but its snapshot is not. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
@ -43,6 +43,12 @@ func Remove(ctx context.Context, client *containerd.Client, name string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error deleting container %s, %s, %s", container.ID(), name, err)
|
return fmt.Errorf("error deleting container %s, %s, %s", container.ID(), name, err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
service := client.SnapshotService("")
|
||||||
|
key := name + "snapshot"
|
||||||
|
if _, err := client.SnapshotService("").Stat(ctx, key); err == nil {
|
||||||
|
service.Remove(ctx, key)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user