Skip to content

Commit

Permalink
handle closed index for getmappings
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelandis committed Oct 3, 2023
1 parent 4df0815 commit 7d2c037
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ public void getRoleMappings(Set<String> names, ActionListener<List<ExpressionRol
private void getMappings(ActionListener<List<ExpressionRoleMapping>> listener) {
final SecurityIndexManager frozenSecurityIndex = securityIndex.defensiveCopy();
if (frozenSecurityIndex.indexExists() == false) {
logger.debug("The security index exists - no role mappings can be loaded");
logger.debug("The security does not index exist - no role mappings can be loaded");
listener.onResponse(Collections.emptyList());
} else if (frozenSecurityIndex.indexIsClosed()) {
logger.debug("The security index exists but is closed - no role mappings can be loaded");
listener.onResponse(Collections.emptyList());
} else if (frozenSecurityIndex.isAvailable(SEARCH_SHARDS) == false) {
logger.debug("The security index exists but is not available - no role mappings can be loaded");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ public boolean indexExists() {
return this.state.indexExists();
}

public boolean indexIsClosed() {
return this.state.indexState == IndexMetadata.State.CLOSE;
}

public Instant getCreationTime() {
return this.state.creationTime;
}
Expand Down

0 comments on commit 7d2c037

Please sign in to comment.