Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Commit

Permalink
Delete repository from all collections (#655)
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Martinez Gotor <[email protected]>
  • Loading branch information
Andres Martinez Gotor authored Nov 28, 2019
1 parent 1402653 commit aec06fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/chart-repo/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ func deleteRepo(dbSession datastore.Session, repoName string) error {
_, err = db.C(chartFilesCollection).RemoveAll(bson.M{
"repo.name": repoName,
})
if err != nil {
return err
}

_, err = db.C(repositoryCollection).RemoveAll(bson.M{
"_id": repoName,
})
return err
}

Expand Down
3 changes: 3 additions & 0 deletions cmd/chart-repo/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ func Test_DeleteRepo(t *testing.T) {
m.On("RemoveAll", bson.M{
"repo.name": "test",
})
m.On("RemoveAll", bson.M{
"_id": "test",
})
dbSession := mockstore.NewMockSession(m)

err := deleteRepo(dbSession, "test")
Expand Down

0 comments on commit aec06fb

Please sign in to comment.