Skip to content

Commit f5d4085

Browse files
committed
fixup!
1 parent 493ad59 commit f5d4085

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

x-pack/plugin/esql/src/main/generated/org/elasticsearch/xpack/esql/expression/function/scalar/math/HypotEvaluator.java

Lines changed: 19 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/SecurityIndexManager.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import org.elasticsearch.rest.RestStatus;
4848
import org.elasticsearch.threadpool.Scheduler;
4949
import org.elasticsearch.xcontent.XContentType;
50+
import org.elasticsearch.xpack.core.security.authc.support.mapper.ExpressionRoleMapping;
5051
import org.elasticsearch.xpack.core.security.authz.RoleMappingMetadata;
5152
import org.elasticsearch.xpack.security.SecurityFeatures;
5253

@@ -273,7 +274,18 @@ private static boolean isCreatedOnLatestVersion(IndexMetadata indexMetadata) {
273274

274275
private static Set<String> getFileSettingsMetadataHandlerRoleMappingKeys(ClusterState clusterState) {
275276
ReservedStateMetadata fileSettingsMetadata = clusterState.metadata().reservedStateMetadata().get(FILE_SETTINGS_METADATA_NAMESPACE);
276-
return fileSettingsMetadata.handlers().get(HANDLER_ROLE_MAPPINGS_NAME).keys();
277+
if (fileSettingsMetadata != null && fileSettingsMetadata.handlers().containsKey(HANDLER_ROLE_MAPPINGS_NAME)) {
278+
return fileSettingsMetadata.handlers().get(HANDLER_ROLE_MAPPINGS_NAME).keys();
279+
}
280+
return Set.of();
281+
}
282+
283+
private static Set<ExpressionRoleMapping> getRoleMappingMetadataMappings(ClusterState clusterState) {
284+
RoleMappingMetadata roleMappingMetadata = RoleMappingMetadata.getFromClusterState(clusterState);
285+
if (roleMappingMetadata == null) {
286+
return Set.of();
287+
}
288+
return roleMappingMetadata.getRoleMappings();
277289
}
278290

279291
@Override
@@ -294,9 +306,8 @@ public void clusterChanged(ClusterChangedEvent event) {
294306
final boolean indexAvailableForWrite = available.v1();
295307
final boolean indexAvailableForSearch = available.v2();
296308
final Set<String> reservedStateRoleMappingNames = getFileSettingsMetadataHandlerRoleMappingKeys(event.state());
297-
final boolean reservedRoleMappingsSynced = reservedStateRoleMappingNames.size() == RoleMappingMetadata.getFromClusterState(
298-
event.state()
299-
).getRoleMappings().size();
309+
final boolean reservedRoleMappingsSynced = reservedStateRoleMappingNames.size() == getRoleMappingMetadataMappings(event.state())
310+
.size();
300311
final boolean mappingIsUpToDate = indexMetadata == null || checkIndexMappingUpToDate(event.state());
301312
final int migrationsVersion = getMigrationVersionFromIndexMetadata(indexMetadata);
302313
final SystemIndexDescriptor.MappingsVersion minClusterMappingVersion = getMinSecurityIndexMappingVersion(event.state());

0 commit comments

Comments
 (0)