@@ -291,24 +291,23 @@ private void checkIngestPipelineBeforeDeleteModel(String modelId, ActionListener
291
291
GetPipelineRequest getPipelineRequest = new GetPipelineRequest ();
292
292
client .execute (GetPipelineAction .INSTANCE , getPipelineRequest , ActionListener .wrap (ingestPipelineResponse -> {
293
293
List <String > allRelevantPipelineIds = findRelevantPipelines (
294
- ingestPipelineResponse .pipelines (),
295
- modelId ,
296
- org .opensearch .ingest .PipelineConfiguration ::getConfigAsMap ,
297
- org .opensearch .ingest .PipelineConfiguration ::getId
294
+ ingestPipelineResponse .pipelines (),
295
+ modelId ,
296
+ org .opensearch .ingest .PipelineConfiguration ::getConfigAsMap ,
297
+ org .opensearch .ingest .PipelineConfiguration ::getId
298
298
);
299
299
if (allRelevantPipelineIds .isEmpty ()) {
300
300
actionListener .onResponse (true );
301
- }
302
- else {
301
+ } else {
303
302
actionListener
304
- .onFailure (
305
- new OpenSearchStatusException (
306
- allRelevantPipelineIds .size ()
307
- + " ingest pipelines are still using this model, please delete or update the pipelines first: "
308
- + Arrays .toString (allRelevantPipelineIds .toArray (new String [0 ])),
309
- RestStatus .CONFLICT
310
- )
311
- );
303
+ .onFailure (
304
+ new OpenSearchStatusException (
305
+ allRelevantPipelineIds .size ()
306
+ + " ingest pipelines are still using this model, please delete or update the pipelines first: "
307
+ + Arrays .toString (allRelevantPipelineIds .toArray (new String [0 ])),
308
+ RestStatus .CONFLICT
309
+ )
310
+ );
312
311
}
313
312
}, e -> {
314
313
log .error ("Failed to delete ML Model: " + modelId , e );
@@ -322,24 +321,23 @@ private void checkSearchPipelineBeforeDeleteModel(String modelId, ActionListener
322
321
GetSearchPipelineRequest getSearchPipelineRequest = new GetSearchPipelineRequest ();
323
322
client .execute (GetSearchPipelineAction .INSTANCE , getSearchPipelineRequest , ActionListener .wrap (searchPipelineResponse -> {
324
323
List <String > allRelevantPipelineIds = findRelevantPipelines (
325
- searchPipelineResponse .pipelines (),
326
- modelId ,
327
- org .opensearch .search .pipeline .PipelineConfiguration ::getConfigAsMap ,
328
- org .opensearch .search .pipeline .PipelineConfiguration ::getId
324
+ searchPipelineResponse .pipelines (),
325
+ modelId ,
326
+ org .opensearch .search .pipeline .PipelineConfiguration ::getConfigAsMap ,
327
+ org .opensearch .search .pipeline .PipelineConfiguration ::getId
329
328
);
330
329
if (allRelevantPipelineIds .isEmpty ()) {
331
330
actionListener .onResponse (true );
332
- }
333
- else {
331
+ } else {
334
332
actionListener
335
- .onFailure (
336
- new OpenSearchStatusException (
337
- allRelevantPipelineIds .size ()
338
- + " search pipelines are still using this model, please delete or update the pipelines first: "
339
- + Arrays .toString (allRelevantPipelineIds .toArray (new String [0 ])),
340
- RestStatus .CONFLICT
341
- )
342
- );
333
+ .onFailure (
334
+ new OpenSearchStatusException (
335
+ allRelevantPipelineIds .size ()
336
+ + " search pipelines are still using this model, please delete or update the pipelines first: "
337
+ + Arrays .toString (allRelevantPipelineIds .toArray (new String [0 ])),
338
+ RestStatus .CONFLICT
339
+ )
340
+ );
343
341
}
344
342
}, e -> {
345
343
log .error ("Failed to delete ML Model: " + modelId , e );
@@ -513,7 +511,6 @@ private Boolean searchThroughConfig(Object searchCandidate, String candidateId,
513
511
return flag ;
514
512
}
515
513
516
-
517
514
// this method is only to stub static method.
518
515
@ VisibleForTesting
519
516
boolean isSuperAdminUserWrapper (ClusterService clusterService , Client client ) {
0 commit comments