Skip to content

Commit

Permalink
Fix issue with import catalog (#217)
Browse files Browse the repository at this point in the history
- Fixed an issue where the name of the catalog would be wrong when importing vms
  • Loading branch information
cjlapao authored Oct 21, 2024
1 parent 610ab1d commit ffb968d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/catalog/import_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package catalog

import (
"encoding/json"
"fmt"
"path/filepath"
"strings"

Expand Down Expand Up @@ -96,7 +95,7 @@ func (s *CatalogManifestService) ImportVm(ctx basecontext.ApiContext, r *models.
}
catalogManifest = models.NewVirtualMachineCatalogManifest()

catalogManifest.Name = fmt.Sprintf("%v-%v", r.CatalogId, r.Version)
catalogManifest.Name = r.Name()
catalogManifest.Type = r.Type
catalogManifest.Description = r.Description
catalogManifest.RequiredClaims = r.RequiredClaims
Expand All @@ -117,11 +116,10 @@ func (s *CatalogManifestService) ImportVm(ctx basecontext.ApiContext, r *models.
response.AddError(err)
break
}

}
} else {
catalogManifest = models.NewVirtualMachineCatalogManifest()
catalogManifest.Name = fmt.Sprintf("%v-%v", r.CatalogId, r.Version)
catalogManifest.Name = r.Name()
catalogManifest.Type = r.Type
catalogManifest.Description = r.Description
catalogManifest.RequiredClaims = r.RequiredClaims
Expand Down
1 change: 0 additions & 1 deletion src/data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ func (j *JsonDatabase) processSave(ctx basecontext.ApiContext) error {
if err = j.copyCurrentDbFileToTemp(ctx, dateTimeForFile); err != nil {
ctx.LogDebugf("[Database] Error copying current file to backup: %v", err)
j.isSaving = false
j.saveMutex.Unlock()
return err
}

Expand Down

0 comments on commit ffb968d

Please sign in to comment.