Minor bug with removing container name if import fails. Fixed.
This commit is contained in:
@@ -109,14 +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)
|
||||
_ = container.DeleteSource(name)
|
||||
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)
|
||||
_ = container.DeleteSource(name)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,5 +88,6 @@ func ValidSource(name string) bool {
|
||||
func DeleteSource(name string) error {
|
||||
fullPath := SourceDir(name)
|
||||
|
||||
wwlog.Printf(wwlog.VERBOSE, "Removing path: %s\n", fullPath)
|
||||
return os.RemoveAll(fullPath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user