Skip to content

Commit

Permalink
Do not make any output in case of skipped/already-up-to-date
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Mar 22, 2024
1 parent 2a634d7 commit 7955539
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions commands/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,14 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rp
logrus.WithField("url", URL).Print("Updating index")

if URL.Scheme == "file" {
downloadCB.Start(u, tr("Downloading index: %s", filepath.Base(URL.Path)))
path := paths.New(URL.Path)
if _, err := packageindex.LoadIndexNoSign(path); err != nil {
msg := fmt.Sprintf("%s: %v", tr("Invalid package index in %s", path), err)
downloadCB.Start(u, tr("Downloading index: %s", filepath.Base(URL.Path)))
downloadCB.End(false, msg)
failed = true
result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_FAILED))
} else {
downloadCB.End(true, "")
result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_SKIPPED))
}
continue
Expand All @@ -514,8 +513,6 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rp
if info, err := indexFile.Stat(); err == nil {
ageSecs := int64(time.Since(info.ModTime()).Seconds())
if ageSecs < req.GetUpdateIfOlderThanSecs() {
downloadCB.Start(u, tr("Downloading index: %s", filepath.Base(URL.Path)))
downloadCB.End(true, tr("Index is already up-to-date"))
result.UpdatedIndexes = append(result.UpdatedIndexes, report(URL, rpc.IndexUpdateReport_STATUS_ALREADY_UP_TO_DATE))
continue
}
Expand Down

0 comments on commit 7955539

Please sign in to comment.