Integrate PublishedRepos with storages & context. #15

This commit is contained in:
Andrey Smirnov
2014-07-21 17:43:12 +04:00
parent 6d026afc69
commit 915b0d1697
10 changed files with 77 additions and 30 deletions
+5 -2
View File
@@ -865,14 +865,17 @@ func (collection *PublishedRepoCollection) LoadComplete(repo *PublishedRepo, col
return
}
// ByPrefixDistribution looks up repository by storage, prefix & distribution
// ByStoragePrefixDistribution looks up repository by storage, prefix & distribution
func (collection *PublishedRepoCollection) ByStoragePrefixDistribution(storage, prefix, distribution string) (*PublishedRepo, error) {
for _, r := range collection.list {
if r.Prefix == prefix && r.Distribution == distribution && r.Storage == storage {
return r, nil
}
}
return nil, fmt.Errorf("published repo with storage/prefix/distribution %s/%s/%s not found", storage, prefix, distribution)
if storage != "" {
storage += ":"
}
return nil, fmt.Errorf("published repo with storage:prefix/distribution %s%s/%s not found", storage, prefix, distribution)
}
// ByUUID looks up repository by uuid