From b93890b0df85cdaeafae5bf41a43e14071f06ca5 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Tue, 4 Jul 2017 15:10:18 +0100 Subject: [PATCH] [ML] Add license downgrade warning (elastic/x-pack-elasticsearch#1912) When applying a license that will cause ML to be disabled, a warning to this effect is now included in the acknowledgement messages. relates elastic/x-pack-elasticsearch#1888 Original commit: elastic/x-pack-elasticsearch@e453f20f58658776c96e2c8a164733b37f3c2569 --- .../elasticsearch/license/XPackLicenseState.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugin/src/main/java/org/elasticsearch/license/XPackLicenseState.java b/plugin/src/main/java/org/elasticsearch/license/XPackLicenseState.java index 7dd392a1b16..de331f153c2 100644 --- a/plugin/src/main/java/org/elasticsearch/license/XPackLicenseState.java +++ b/plugin/src/main/java/org/elasticsearch/license/XPackLicenseState.java @@ -71,6 +71,7 @@ public class XPackLicenseState { messages.put(XPackPlugin.WATCHER, XPackLicenseState::watcherAcknowledgementMessages); messages.put(XPackPlugin.MONITORING, XPackLicenseState::monitoringAcknowledgementMessages); messages.put(XPackPlugin.GRAPH, XPackLicenseState::graphAcknowledgementMessages); + messages.put(XPackPlugin.MACHINE_LEARNING, XPackLicenseState::machineLearningAcknowledgementMessages); messages.put(XPackPlugin.LOGSTASH, XPackLicenseState::logstashAcknowledgementMessages); ACKNOWLEDGMENT_MESSAGES = Collections.unmodifiableMap(messages); } @@ -177,6 +178,21 @@ public class XPackLicenseState { return Strings.EMPTY_ARRAY; } + private static String[] machineLearningAcknowledgementMessages(OperationMode currentMode, OperationMode newMode) { + switch (newMode) { + case BASIC: + case STANDARD: + case GOLD: + switch (currentMode) { + case TRIAL: + case PLATINUM: + return new String[] { "Machine learning will be disabled" }; + } + break; + } + return Strings.EMPTY_ARRAY; + } + private static String[] logstashAcknowledgementMessages(OperationMode currentMode, OperationMode newMode) { switch (newMode) { case BASIC: