If container import fails, delete the installed container dir (issue #28)

This commit is contained in:
Gregory Kurtzer
2021-03-06 18:18:05 -08:00
parent e149afd580
commit 455848463f

View File

@@ -109,12 +109,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
err = container.ImportDocker(uri, name, sCtx)
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not import image: %s\n", err)
_ = container.DeleteSource(uri)
os.Exit(1)
}
} else if util.IsDir(uri) {
err := container.ImportDirectory(uri, name)
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not import image: %s\n", err)
_ = container.DeleteSource(uri)
os.Exit(1)
}
}