enh: Give info when unable to load list of repos

This commit is contained in:
Samuel Mutel
2022-04-22 16:14:50 +02:00
committed by Benj Fassbind
parent 152538ccc1
commit 4c04e77489
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -46,3 +46,4 @@ List of contributors, in chronological order:
* Benj Fassbind (https://github.com/randombenj) * Benj Fassbind (https://github.com/randombenj)
* Markus Muellner (https://github.com/mmianl) * Markus Muellner (https://github.com/mmianl)
* Chuan Liu (https://github.com/chuan) * Chuan Liu (https://github.com/chuan)
* Samuel Mutel (https://github.com/smutel)
+5
View File
@@ -3,6 +3,7 @@ package cmd
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"os"
"sort" "sort"
"github.com/aptly-dev/aptly/deb" "github.com/aptly-dev/aptly/deb"
@@ -35,6 +36,8 @@ func aptlyPublishListTxt(cmd *commander.Command, args []string) error {
err = collectionFactory.PublishedRepoCollection().ForEach(func(repo *deb.PublishedRepo) error { err = collectionFactory.PublishedRepoCollection().ForEach(func(repo *deb.PublishedRepo) error {
e := collectionFactory.PublishedRepoCollection().LoadComplete(repo, collectionFactory) e := collectionFactory.PublishedRepoCollection().LoadComplete(repo, collectionFactory)
if e != nil { if e != nil {
fmt.Fprintf(os.Stderr, "Error found on one publish (prefix:%s / distribution:%s / component:%s\n)",
repo.StoragePrefix(), repo.Distribution, repo.Components())
return e return e
} }
@@ -82,6 +85,8 @@ func aptlyPublishListJSON(cmd *commander.Command, args []string) error {
err = context.NewCollectionFactory().PublishedRepoCollection().ForEach(func(repo *deb.PublishedRepo) error { err = context.NewCollectionFactory().PublishedRepoCollection().ForEach(func(repo *deb.PublishedRepo) error {
e := context.NewCollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.NewCollectionFactory()) e := context.NewCollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.NewCollectionFactory())
if e != nil { if e != nil {
fmt.Fprintf(os.Stderr, "Error found on one publish (prefix:%s / distribution:%s / component:%s\n)",
repo.StoragePrefix(), repo.Distribution, repo.Components())
return e return e
} }