Fix StorageMongo.RemoveDestination

This commit is contained in:
DanB
2017-01-16 13:14:15 +01:00
parent 2b121bfba7
commit d87705ed54
2 changed files with 7 additions and 4 deletions

View File

@@ -924,9 +924,9 @@ func testOnStorITCRUDDestination(t *testing.T) {
} else if !reflect.DeepEqual(dst, rcv) {
t.Errorf("Expecting: %v, received: %v", dst, rcv)
}
//FixMe if err = onStor.RemoveDestination(dst.Id, utils.NonTransactional); err != nil {
// t.Error(err)
// }
if err = onStor.RemoveDestination(dst.Id, utils.NonTransactional); err != nil {
t.Error(err)
}
// if _, rcvErr := onStor.GetDestination(dst.Id, true, utils.NonTransactional); rcvErr != utils.ErrNotFound {
// t.Error(rcvErr)
// }

View File

@@ -922,9 +922,12 @@ func (ms *MongoStorage) RemoveDestination(destID string, transactionID string) (
// get destination for prefix list
d, err := ms.GetDestination(destID, false, transactionID)
if err != nil {
if err == mgo.ErrNotFound {
err = nil
}
return
}
err = col.Remove(bson.M{"key": key})
err = col.Remove(bson.M{"key": destID})
if err != nil {
return err
}