File tree 1 file changed +9
-4
lines changed
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 16
16
import org .elasticsearch .cluster .ClusterState ;
17
17
import org .elasticsearch .cluster .metadata .IndexNameExpressionResolver ;
18
18
import org .elasticsearch .cluster .metadata .Metadata ;
19
+ import org .elasticsearch .cluster .metadata .ProjectMetadata ;
19
20
import org .elasticsearch .cluster .node .DiscoveryNode ;
20
21
import org .elasticsearch .cluster .node .DiscoveryNodes ;
21
22
import org .elasticsearch .cluster .routing .allocation .DataTier ;
@@ -296,11 +297,15 @@ public static List<DiscoveryNode> nodesNotReadyForXPackCustomMetadata(ClusterSta
296
297
private static boolean alreadyContainsXPackCustomMetadata (ClusterState clusterState ) {
297
298
final Metadata metadata = clusterState .metadata ();
298
299
return metadata .custom (LicensesMetadata .TYPE ) != null
299
- || metadata .getProject ().custom (MlMetadata .TYPE ) != null
300
- || metadata .getProject ().custom (WatcherMetadata .TYPE ) != null
301
- || RoleMappingMetadata .getFromClusterState (clusterState ).isEmpty () == false
302
300
|| clusterState .custom (TokenMetadata .TYPE ) != null
303
- || metadata .getProject ().custom (TransformMetadata .TYPE ) != null ;
301
+ || metadata .projects ().values ().stream ().anyMatch (XPackPlugin ::alreadyContainsXPackCustomMetadata );
302
+ }
303
+
304
+ private static boolean alreadyContainsXPackCustomMetadata (ProjectMetadata project ) {
305
+ return project .custom (MlMetadata .TYPE ) != null
306
+ || project .custom (WatcherMetadata .TYPE ) != null
307
+ || RoleMappingMetadata .getFromProject (project ).isEmpty () == false
308
+ || project .custom (TransformMetadata .TYPE ) != null ;
304
309
}
305
310
306
311
@ Override
You can’t perform that action at this time.
0 commit comments