From f696ad1d10db04ace39ef1476e2bef1861f6c7df Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Fri, 28 Oct 2016 15:04:06 +0200 Subject: [PATCH] Skip authentication and warn if shards of the .security index are not available Original commit: elastic/x-pack-elasticsearch@9970d80f2db36058dcfd558df21de4a43b80d768 --- .../xpack/security/authz/store/NativeRolesStore.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java index 7ea22d8dec4..b816713975a 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/security/authz/store/NativeRolesStore.java @@ -21,6 +21,7 @@ import org.elasticsearch.action.search.MultiSearchResponse; import org.elasticsearch.action.search.MultiSearchResponse.Item; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.support.ThreadedActionListener; +import org.elasticsearch.action.support.TransportActions; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateListener; @@ -428,7 +429,8 @@ public class NativeRolesStore extends AbstractComponent implements ClusterStateL @Override public void onFailure(Exception e) { - if (e instanceof IndexNotFoundException) { // if the index is not there we just claim the role is not there + // if the index or the shard is not there / available we just claim the role is not there + if (TransportActions.isShardNotAvailableException(e)) { logger.warn((Supplier) () -> new ParameterizedMessage("failed to load role [{}] index not available", roleId), e); roleActionListener.onResponse(RoleAndVersion.NON_EXISTENT);