kpod: shut down the storage library before exiting

Before exiting, have kpod shut down the storage library if it can.  This
should keep us from leaving mountpoints for the root (for non-vfs cases)
and run directory (with newer containers/storage) busy when testing kpod.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2017-08-17 10:23:54 -04:00
parent 3a2518ce33
commit ef8df00e6a
8 changed files with 33 additions and 2 deletions

View file

@ -50,6 +50,16 @@ func main() {
}
return nil
}
app.After = func(*cli.Context) error {
// called by Run() when the command handler succeeds
shutdownStores()
return nil
}
cli.OsExiter = func(code int) {
// called by Run() when the command fails, bypassing After()
shutdownStores()
os.Exit(code)
}
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config, c",
@ -82,6 +92,6 @@ func main() {
}
if err := app.Run(os.Args); err != nil {
logrus.Errorf(err.Error())
os.Exit(1)
cli.OsExiter(1)
}
}