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

Commit

Permalink
Allow removing an App when referenced by id in unambiguous cases
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Christophe Sirot <jean-christophe.sirot@docker.com>
  • Loading branch information
Jean-Christophe Sirot committed Nov 13, 2019
1 parent 61e61a8 commit e436fbe
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/store/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ func (b *bundleStore) List() ([]reference.Reference, error) {

// Remove removes a bundle from the bundle store.
func (b *bundleStore) Remove(ref reference.Reference) error {
if id, ok := ref.(ID); ok {
if len(b.refsMap[id]) == 0 {
return fmt.Errorf("no such image %q", reference.FamiliarString(ref))
} else if len(b.refsMap[id]) > 1 {
return fmt.Errorf("unable to delete %s - App is referenced in multiple repositories", reference.FamiliarString(ref))
}
ref = b.refsMap[id][0]
}
path, err := b.storePath(ref)
if err != nil {
return err
Expand Down

0 comments on commit e436fbe

Please sign in to comment.