Fix progress output for ISO generation

The way this was coded was causing bugs in output when creating an ISO
image. The most obvious was the line "Cleaning up from ISO creation"
would be repeated a few times at the end of execution.

Having sub-progress loops doesn't make sense here, since the flow is
"task"->"completion status" not "task"->"subtask"->"sub
complete"->"task complete"

Also, the removed progress loops would fail to be printed anyways, so
removing them doesn't change progress output except for fixing this
bug.

Signed-off-by: Brian J Lovin <brian.j.lovin@intel.com>
This commit is contained in:
Brian J Lovin
2019-05-24 10:28:07 -07:00
committed by Brian Lovin
parent 2edeaaad26
commit 7a77abeb19
2 changed files with 4 additions and 11 deletions
+2 -9
View File
@@ -409,13 +409,10 @@ func Install(rootDir string, model *model.SystemInstall, options args.Args) erro
prg.Success()
if model.MakeISO {
msg = "Generating ISO image"
prg = progress.NewLoop(msg)
log.Info(msg)
log.Info("Generating ISO image")
if err = generateISO(rootDir, model, options); err != nil {
log.ErrorError(err)
}
prg.Success()
}
msg = utils.Locale.Get("Installation completed")
@@ -762,9 +759,7 @@ func saveInstallResults(rootDir string, md *model.SystemInstall) error {
// generateISO creates an ISO image from the just created raw image
func generateISO(rootDir string, md *model.SystemInstall, options args.Args) error {
var err error
msg := "Building ISO image"
prg := progress.NewLoop(msg)
log.Info(msg)
log.Info("Building ISO image")
if !md.LegacyBios {
for _, alias := range md.StorageAlias {
@@ -775,10 +770,8 @@ func generateISO(rootDir string, md *model.SystemInstall, options args.Args) err
} else {
err = fmt.Errorf("cannot create ISO images for configurations with LegacyBios enabled")
log.ErrorError(err)
prg.Failure()
return err
}
prg.Success()
return err
}
+2 -2
View File
@@ -37,7 +37,7 @@ var (
)
func mkTmpDirs() error {
msg := "Creating directory trees"
msg := "Making temp directories for ISO creation"
prg := progress.NewLoop(msg)
log.Info(msg)
var err error
@@ -79,7 +79,7 @@ func mkTmpDirs() error {
}
func mkRootfs() error {
msg := "making rootfs squashfs"
msg := "Making squashfs of rootfs"
prg := progress.NewLoop(msg)
log.Info(msg)