From af36665b08a513e4fc8046b22e5e7bf17902dde5 Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Thu, 12 Mar 2020 10:18:39 -0600 Subject: [PATCH] Deprecate the logstash enabled setting (#53487) The setting, `xpack.logstash.enabled`, exists to enable or disable the logstash extensions found within x-pack. In practice, this setting had no effect on the functionality of the extension. Given this, the setting is now deprecated in preparation for removal. Backport of #53367 --- .../elasticsearch/xpack/CcrIntegTestCase.java | 1 - .../xpack/CcrSingleNodeTestCase.java | 1 - .../elasticsearch/xpack/core/XPackSettings.java | 2 +- .../ilm/IndexLifecycleInitialisationTests.java | 1 - .../SnapshotLifecycleInitialisationTests.java | 1 - .../elasticsearch/xpack/logstash/Logstash.java | 17 +---------------- .../xpack/logstash/LogstashFeatureSetTests.java | 4 ++++ 7 files changed, 6 insertions(+), 21 deletions(-) diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java index 7a0a55b7ace..829c63f67fe 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrIntegTestCase.java @@ -225,7 +225,6 @@ public abstract class CcrIntegTestCase extends ESTestCase { builder.put(XPackSettings.MONITORING_ENABLED.getKey(), false); builder.put(XPackSettings.WATCHER_ENABLED.getKey(), false); builder.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), false); - builder.put(XPackSettings.LOGSTASH_ENABLED.getKey(), false); builder.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial"); // Let cluster state api return quickly in order to speed up auto follow tests: builder.put(CcrSettings.CCR_WAIT_FOR_METADATA_TIMEOUT.getKey(), TimeValue.timeValueMillis(100)); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrSingleNodeTestCase.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrSingleNodeTestCase.java index cbfd0784523..9858362c811 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrSingleNodeTestCase.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/CcrSingleNodeTestCase.java @@ -48,7 +48,6 @@ public abstract class CcrSingleNodeTestCase extends ESSingleNodeTestCase { builder.put(XPackSettings.MONITORING_ENABLED.getKey(), false); builder.put(XPackSettings.WATCHER_ENABLED.getKey(), false); builder.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), false); - builder.put(XPackSettings.LOGSTASH_ENABLED.getKey(), false); builder.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial"); // Let cluster state api return quickly in order to speed up auto follow tests: builder.put(CcrSettings.CCR_WAIT_FOR_METADATA_TIMEOUT.getKey(), TimeValue.timeValueMillis(100)); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java index 3b670f84a4f..69885590938 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/XPackSettings.java @@ -88,7 +88,7 @@ public class XPackSettings { /** Setting for enabling or disabling Logstash extensions. Defaults to true. */ public static final Setting LOGSTASH_ENABLED = Setting.boolSetting("xpack.logstash.enabled", true, - Setting.Property.NodeScope); + Setting.Property.NodeScope, Property.Deprecated); /** * Setting for enabling or disabling the index lifecycle extension. Defaults to true. diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java index 3679696a8ea..aa5390d2308 100644 --- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java +++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleInitialisationTests.java @@ -101,7 +101,6 @@ public class IndexLifecycleInitialisationTests extends ESIntegTestCase { settings.put(XPackSettings.WATCHER_ENABLED.getKey(), false); settings.put(XPackSettings.MONITORING_ENABLED.getKey(), false); settings.put(XPackSettings.GRAPH_ENABLED.getKey(), false); - settings.put(XPackSettings.LOGSTASH_ENABLED.getKey(), false); settings.put(LifecycleSettings.LIFECYCLE_POLL_INTERVAL, "1s"); // This is necessary to prevent ILM and SLM installing a lifecycle policy, these tests assume a blank slate diff --git a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java index 180ff53cf5b..58f0b632e13 100644 --- a/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java +++ b/x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleInitialisationTests.java @@ -50,7 +50,6 @@ public class SnapshotLifecycleInitialisationTests extends ESSingleNodeTestCase { settings.put(XPackSettings.WATCHER_ENABLED.getKey(), false); settings.put(XPackSettings.MONITORING_ENABLED.getKey(), false); settings.put(XPackSettings.GRAPH_ENABLED.getKey(), false); - settings.put(XPackSettings.LOGSTASH_ENABLED.getKey(), false); settings.put(Environment.PATH_REPO_SETTING.getKey(), repositoryLocation); settings.put(XPackSettings.SNAPSHOT_LIFECYCLE_ENABLED.getKey(), true); diff --git a/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java b/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java index 13894105341..0b4d007bdf3 100644 --- a/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java +++ b/x-pack/plugin/logstash/src/main/java/org/elasticsearch/xpack/logstash/Logstash.java @@ -15,7 +15,6 @@ import org.elasticsearch.indices.SystemIndexDescriptor; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.SystemIndexPlugin; import org.elasticsearch.xpack.core.XPackPlugin; -import org.elasticsearch.xpack.core.XPackSettings; import org.elasticsearch.xpack.core.template.TemplateUtils; import java.util.ArrayList; @@ -36,21 +35,7 @@ public class Logstash extends Plugin implements SystemIndexPlugin { private static final String OLD_LOGSTASH_INDEX_NAME = "logstash-index-template"; private static final String TEMPLATE_VERSION_VARIABLE = "logstash.template.version"; - private final boolean enabled; - private final boolean transportClientMode; - - public Logstash(Settings settings) { - this.enabled = XPackSettings.LOGSTASH_ENABLED.get(settings); - this.transportClientMode = XPackPlugin.transportClientMode(settings); - } - - boolean isEnabled() { - return enabled; - } - - boolean isTransportClient() { - return transportClientMode; - } + public Logstash() {} public Collection createGuiceModules() { List modules = new ArrayList<>(); diff --git a/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashFeatureSetTests.java b/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashFeatureSetTests.java index a5e575a1a37..9acd0facbfb 100644 --- a/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashFeatureSetTests.java +++ b/x-pack/plugin/logstash/src/test/java/org/elasticsearch/xpack/logstash/LogstashFeatureSetTests.java @@ -7,10 +7,12 @@ package org.elasticsearch.xpack.logstash; import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.xpack.core.XPackFeatureSet; +import org.elasticsearch.xpack.core.XPackSettings; import org.elasticsearch.xpack.core.logstash.LogstashFeatureSetUsage; import static org.mockito.Mockito.mock; @@ -33,6 +35,8 @@ public class LogstashFeatureSetTests extends ESTestCase { usage.writeTo(out); XPackFeatureSet.Usage serializedUsage = new LogstashFeatureSetUsage(out.bytes().streamInput()); assertThat(serializedUsage.enabled(), is(enabled)); + + assertSettingDeprecationsAndWarnings(new Setting[] { XPackSettings.LOGSTASH_ENABLED }); } public void testEnabledDefault() throws Exception {