Watcher: Dont check index auto creation if disabled/transportclient (elastic/x-pack-elasticsearch#975)

When watcher is disabled, no auto index creation checks should happen.

Relates elastic/elasticsearch#23919

Original commit: elastic/x-pack-elasticsearch@d924838b4d
This commit is contained in:
Alexander Reelsen 2017-04-05 18:39:54 +01:00 committed by GitHub
parent a53026498f
commit 16f5f44d41
2 changed files with 6 additions and 1 deletions

View File

@ -208,7 +208,9 @@ public class Watcher implements ActionPlugin, ScriptPlugin {
transportClient = "transport".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey())); transportClient = "transport".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey()));
this.enabled = XPackSettings.WATCHER_ENABLED.get(settings); this.enabled = XPackSettings.WATCHER_ENABLED.get(settings);
this.transportClientMode = XPackPlugin.transportClientMode(settings); this.transportClientMode = XPackPlugin.transportClientMode(settings);
validAutoCreateIndex(settings); if (enabled && transportClientMode == false) {
validAutoCreateIndex(settings);
}
} }
public Collection<Object> createComponents(Clock clock, ScriptService scriptService, InternalClient internalClient, public Collection<Object> createComponents(Clock clock, ScriptService scriptService, InternalClient internalClient,

View File

@ -12,6 +12,7 @@ import java.util.Collections;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.action.support.AutoCreateIndex;
import org.elasticsearch.client.ResponseException; import org.elasticsearch.client.ResponseException;
import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -37,6 +38,8 @@ public class WatcherPluginDisableTests extends ESIntegTestCase {
return Settings.builder() return Settings.builder()
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
.put(XPackSettings.WATCHER_ENABLED.getKey(), false) .put(XPackSettings.WATCHER_ENABLED.getKey(), false)
// prevent auto index creation, as watcher is disabled this should work
.put(AutoCreateIndex.AUTO_CREATE_INDEX_SETTING.getKey(), false)
// disable security because of query cache check and authentication/authorization // disable security because of query cache check and authentication/authorization
.put(XPackSettings.SECURITY_ENABLED.getKey(), false) .put(XPackSettings.SECURITY_ENABLED.getKey(), false)