1515import org .elasticsearch .cluster .block .ClusterBlockException ;
1616import org .elasticsearch .cluster .block .ClusterBlockLevel ;
1717import org .elasticsearch .cluster .metadata .IndexNameExpressionResolver ;
18+ import org .elasticsearch .cluster .project .ProjectResolver ;
1819import org .elasticsearch .cluster .service .ClusterService ;
1920import org .elasticsearch .common .util .concurrent .EsExecutors ;
2021import org .elasticsearch .core .SuppressForbidden ;
3334
3435public class TransportRemoveIndexLifecyclePolicyAction extends TransportMasterNodeAction <Request , Response > {
3536
37+ private final ProjectResolver projectResolver ;
3638 private final IndexNameExpressionResolver indexNameExpressionResolver ;
3739
3840 @ Inject
@@ -41,6 +43,7 @@ public TransportRemoveIndexLifecyclePolicyAction(
4143 ClusterService clusterService ,
4244 ThreadPool threadPool ,
4345 ActionFilters actionFilters ,
46+ ProjectResolver projectResolver ,
4447 IndexNameExpressionResolver indexNameExpressionResolver
4548 ) {
4649 super (
@@ -54,6 +57,7 @@ public TransportRemoveIndexLifecyclePolicyAction(
5457 EsExecutors .DIRECT_EXECUTOR_SERVICE
5558 );
5659 this .indexNameExpressionResolver = indexNameExpressionResolver ;
60+ this .projectResolver = projectResolver ;
5761 }
5862
5963 @ Override
@@ -63,15 +67,16 @@ protected ClusterBlockException checkBlock(Request request, ClusterState state)
6367
6468 @ Override
6569 protected void masterOperation (Task task , Request request , ClusterState state , ActionListener <Response > listener ) throws Exception {
66- final Index [] indices = indexNameExpressionResolver .concreteIndices (state , request .indicesOptions (), true , request .indices ());
70+ final var project = projectResolver .getProjectMetadata (state );
71+ final Index [] indices = indexNameExpressionResolver .concreteIndices (project , request .indicesOptions (), true , request .indices ());
6772 submitUnbatchedTask ("remove-lifecycle-for-index" , new ClusterStateUpdateTask (request .masterNodeTimeout ()) {
6873
6974 private final List <String > failedIndexes = new ArrayList <>();
7075
7176 @ Override
7277 public ClusterState execute (ClusterState currentState ) throws Exception {
73- final var project = currentState .metadata ().getProject ();
74- final var updatedProject = IndexLifecycleTransition .removePolicyForIndexes (indices , project , failedIndexes );
78+ final var currentProjet = currentState .metadata ().getProject (project . id () );
79+ final var updatedProject = IndexLifecycleTransition .removePolicyForIndexes (indices , currentProjet , failedIndexes );
7580 return ClusterState .builder (currentState ).putProjectMetadata (updatedProject ).build ();
7681 }
7782
0 commit comments