diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2017-12-03 08:25:16 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-12-04 17:17:06 +0000 |
commit | 55c8b69d8f80b31c5748c1bd50c812aaa0e6c1c7 (patch) | |
tree | 4d967dc0a016337201e64af0a141e80e0e9e6e69 /libpod/runtime.go | |
parent | 5c9694a0c1fc1d717c61597f659590dcb7b6f25b (diff) | |
download | podman-55c8b69d8f80b31c5748c1bd50c812aaa0e6c1c7.tar.gz podman-55c8b69d8f80b31c5748c1bd50c812aaa0e6c1c7.tar.bz2 podman-55c8b69d8f80b31c5748c1bd50c812aaa0e6c1c7.zip |
When shutting down the runtime we should always close the database
Even if the storage fails to shutdown. This patch fixes on TODO.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #97
Approved by: mheon
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 4a45bf008..b86e06546 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -225,11 +225,16 @@ func (r *Runtime) Shutdown(force bool) error { } } - _, err := r.store.Shutdown(force) - if err != nil { - return err + var lastError error + if _, err := r.store.Shutdown(force); err != nil { + lastError = errors.Wrapf(err, "Error shutting down container storage") + } + if err := r.state.Close(); err != nil { + if lastError != nil { + logrus.Errorf("%v", lastError) + } + lastError = err } - // TODO: Should always call this even if store.Shutdown failed - return r.state.Close() + return lastError } |