mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-09-01 11:15:49 +00:00
Fix remaining two logic lints
Signed-off-by: William Douglas <william.douglas@intel.com>
This commit is contained in:
committed by
William Douglas
parent
04eee0d0bb
commit
8031794511
+7
-8
@@ -450,16 +450,15 @@ func (b *Builder) BuildImage(format string, configFile string) error {
|
||||
|
||||
// If the legacy JSON file exists, rename the old file to prevent migration
|
||||
// each time we build and discourage the user from using the old JSON file.
|
||||
if _, err := os.Stat(migrationFile); os.IsNotExist(err) {
|
||||
} else if err != nil {
|
||||
if _, err := os.Stat(migrationFile); err != nil && !os.IsNotExist(err) {
|
||||
return err
|
||||
} else {
|
||||
renameFile := migrationFile + "-EOL"
|
||||
log.Info(log.Mixer, " Renaming previous generation config %s to %s", migrationFile, renameFile)
|
||||
if mvErr := os.Rename(migrationFile, renameFile); mvErr != nil {
|
||||
log.Warning(log.Mixer, "Failed to rename %s: %v", migrationFile, mvErr)
|
||||
}
|
||||
}
|
||||
renameFile := migrationFile + "-EOL"
|
||||
log.Info(log.Mixer, " Renaming previous generation config %s to %s", migrationFile, renameFile)
|
||||
if mvErr := os.Rename(migrationFile, renameFile); mvErr != nil {
|
||||
log.Warning(log.Mixer, "Failed to rename %s: %v", migrationFile, mvErr)
|
||||
}
|
||||
|
||||
} else {
|
||||
if !strings.HasSuffix(configFile, "yaml") {
|
||||
return fmt.Errorf("build configuration file '%s' must end in .yaml", configFile)
|
||||
|
||||
+11
-12
@@ -93,24 +93,23 @@ func initBundles(ui UpdateInfo, c config, numWorkers int) ([]*Manifest, error) {
|
||||
tmpManifests = append(tmpManifests, bundle)
|
||||
mux.Unlock()
|
||||
continue
|
||||
} else {
|
||||
log.Info(log.Mixer, "- %s", bundleName)
|
||||
biPath := filepath.Join(c.imageBase, fmt.Sprint(ui.version), bundle.Name+"-info")
|
||||
if _, err = os.Stat(biPath); os.IsNotExist(err) {
|
||||
err = syncToFull(ui.version, bundle.Name, c.imageBase)
|
||||
if err != nil {
|
||||
errorChan <- err
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
err = bundle.GetBundleInfo(c.stateDir, biPath)
|
||||
}
|
||||
log.Info(log.Mixer, "- %s", bundleName)
|
||||
biPath := filepath.Join(c.imageBase, fmt.Sprint(ui.version), bundle.Name+"-info")
|
||||
if _, err = os.Stat(biPath); os.IsNotExist(err) {
|
||||
err = syncToFull(ui.version, bundle.Name, c.imageBase)
|
||||
if err != nil {
|
||||
errorChan <- err
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
err = bundle.GetBundleInfo(c.stateDir, biPath)
|
||||
if err != nil {
|
||||
errorChan <- err
|
||||
return
|
||||
}
|
||||
|
||||
mux.Lock()
|
||||
tmpManifests = append(tmpManifests, bundle)
|
||||
mux.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user