mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon/images: ImageService.Cleanup(): return error instead of logging
This makes the function a bit more idiomatic, and leaves it to the caller to decide wether or not the error can be ignored. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
32e5fe5099
commit
79cad59d97
2 changed files with 6 additions and 4 deletions
|
@ -1206,7 +1206,9 @@ func (daemon *Daemon) Shutdown() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if daemon.imageService != nil {
|
if daemon.imageService != nil {
|
||||||
daemon.imageService.Cleanup()
|
if err := daemon.imageService.Cleanup(); err != nil {
|
||||||
|
logrus.Error(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are part of a cluster, clean up cluster's stuff
|
// If we are part of a cluster, clean up cluster's stuff
|
||||||
|
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"github.com/docker/libtrust"
|
"github.com/docker/libtrust"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"golang.org/x/sync/singleflight"
|
"golang.org/x/sync/singleflight"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -167,10 +166,11 @@ func (i *ImageService) GetLayerMountID(cid string) (string, error) {
|
||||||
|
|
||||||
// Cleanup resources before the process is shutdown.
|
// Cleanup resources before the process is shutdown.
|
||||||
// called from daemon.go Daemon.Shutdown()
|
// called from daemon.go Daemon.Shutdown()
|
||||||
func (i *ImageService) Cleanup() {
|
func (i *ImageService) Cleanup() error {
|
||||||
if err := i.layerStore.Cleanup(); err != nil {
|
if err := i.layerStore.Cleanup(); err != nil {
|
||||||
logrus.Errorf("Error during layer Store.Cleanup(): %v", err)
|
return errors.Wrap(err, "error during layerStore.Cleanup()")
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GraphDriverName returns the name of the graph drvier
|
// GraphDriverName returns the name of the graph drvier
|
||||||
|
|
Loading…
Reference in a new issue