Skip to content

Commit

Permalink
sync-repodb minor error checking fix
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentiuNiculae authored and andaaron committed Oct 6, 2022
1 parent 3b7c02a commit 8f19bea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/storage/repodb/sync_repodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,18 @@ func SyncRepo(repo string, repoDB RepoDB, storeController storage.StoreControlle

func resetRepoMetaTags(repo string, repoDB RepoDB, log log.Logger) error {
repoMeta, err := repoDB.GetRepoMeta(repo)
if err != nil {
if err != nil && !errors.Is(err, zerr.ErrRepoMetaNotFound) {
log.Error().Err(err).Msgf("sync-repo: failed to get RepoMeta for repo %s", repo)

return err
}

if errors.Is(err, zerr.ErrRepoMetaNotFound) {
log.Info().Msgf("sync-repo: RepoMeta not found for repo %s, new RepoMeta will be created", repo)

return nil
}

for tag := range repoMeta.Tags {
// We should have a way to delete all tags at once
err := repoDB.DeleteRepoTag(repo, tag)
Expand Down

0 comments on commit 8f19bea

Please sign in to comment.