Add appends new repo to collection and saves it
(repo *PublishedRepo)
| 1326 | |
| 1327 | // Add appends new repo to collection and saves it |
| 1328 | func (collection *PublishedRepoCollection) Add(repo *PublishedRepo) error { |
| 1329 | collection.loadList() |
| 1330 | |
| 1331 | if collection.CheckDuplicate(repo) != nil { |
| 1332 | return fmt.Errorf("published repo with storage/prefix/distribution %s/%s/%s already exists", repo.Storage, repo.Prefix, repo.Distribution) |
| 1333 | } |
| 1334 | |
| 1335 | err := collection.Update(repo) |
| 1336 | if err != nil { |
| 1337 | return err |
| 1338 | } |
| 1339 | |
| 1340 | collection.list = append(collection.list, repo) |
| 1341 | return nil |
| 1342 | } |
| 1343 | |
| 1344 | // CheckDuplicate verifies that there's no published repo with the same name |
| 1345 | func (collection *PublishedRepoCollection) CheckDuplicate(repo *PublishedRepo) *PublishedRepo { |
nothing calls this directly
no test coverage detected