Ignoring message from MinIO (#2515)

As discussed with @harshavardhana , we should ignore the message on delete in the API. After @poornas changed in PR https://github.com/minio/minio/pull/16221 this message is expected and cannot be considered as an error.
This commit is contained in:
Cesar Celis Hernandez
2022-12-16 15:16:19 -05:00
committed by GitHub
parent 96e55ca79b
commit 4c4094420b
3 changed files with 62 additions and 4 deletions

View File

@@ -111,9 +111,14 @@ func registerAdminBucketRemoteHandlers(api *operations.ConsoleAPI) {
api.BucketDeleteAllReplicationRulesHandler = bucketApi.DeleteAllReplicationRulesHandlerFunc(func(params bucketApi.DeleteAllReplicationRulesParams, session *models.Principal) middleware.Responder {
err := deleteBucketReplicationRulesResponse(session, params)
if err != nil {
if err.Code == 500 && *err.DetailedMessage == "The remote target does not exist" {
// We should ignore this MinIO error when deleting all replication rules
return bucketApi.NewDeleteAllReplicationRulesNoContent() // This will return 204 as per swagger spec
}
// If there is a different error, then we should handle it
// This will return a generic error with err.Code (likely a 500 or 404) and its *err.DetailedMessage
return bucketApi.NewDeleteAllReplicationRulesDefault(int(err.Code)).WithPayload(err)
}
return bucketApi.NewDeleteAllReplicationRulesNoContent()
})