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

Commit aec06fb

Browse files
author
Andres Martinez Gotor
authored
Delete repository from all collections (#655)
Signed-off-by: Andres Martinez Gotor <[email protected]>
1 parent 1402653 commit aec06fb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cmd/chart-repo/utils.go

+7
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@ func deleteRepo(dbSession datastore.Session, repoName string) error {
212212
_, err = db.C(chartFilesCollection).RemoveAll(bson.M{
213213
"repo.name": repoName,
214214
})
215+
if err != nil {
216+
return err
217+
}
218+
219+
_, err = db.C(repositoryCollection).RemoveAll(bson.M{
220+
"_id": repoName,
221+
})
215222
return err
216223
}
217224

cmd/chart-repo/utils_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ func Test_DeleteRepo(t *testing.T) {
336336
m.On("RemoveAll", bson.M{
337337
"repo.name": "test",
338338
})
339+
m.On("RemoveAll", bson.M{
340+
"_id": "test",
341+
})
339342
dbSession := mockstore.NewMockSession(m)
340343

341344
err := deleteRepo(dbSession, "test")

0 commit comments

Comments
 (0)