From b564e6e1027cd88ffde2fb605b7303017ee0b828 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Tue, 30 May 2017 16:08:21 -0400 Subject: [PATCH] Upgrade API should work with TRIAL license as well (elastic/x-pack-elasticsearch#1567) Relates to elastic/x-pack-elasticsearch#1214 Original commit: elastic/x-pack-elasticsearch@2ad7e389fbf13c6beb1c42ee85815ec23dc3b6d1 --- .../org/elasticsearch/license/XPackLicenseState.java | 12 +++--------- .../org/elasticsearch/xpack/upgrade/Upgrade.java | 2 +- .../xpack/upgrade/IndexUpgradeIntegTestCase.java | 4 ++-- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/plugin/src/main/java/org/elasticsearch/license/XPackLicenseState.java b/plugin/src/main/java/org/elasticsearch/license/XPackLicenseState.java index 5bebff07b7a..7dd392a1b16 100644 --- a/plugin/src/main/java/org/elasticsearch/license/XPackLicenseState.java +++ b/plugin/src/main/java/org/elasticsearch/license/XPackLicenseState.java @@ -464,7 +464,7 @@ public class XPackLicenseState { /** * Determine if Upgrade API should be enabled. *

- * Upgrade API is not available in for all license types except {@link OperationMode#TRIAL} + * Upgrade API is not available in for all license types except {@link OperationMode#MISSING} * * @return {@code true} as long as the license is valid. Otherwise * {@code false}. @@ -472,13 +472,7 @@ public class XPackLicenseState { public boolean isUpgradeAllowed() { // status is volatile Status localStatus = status; - OperationMode operationMode = localStatus.mode; - - boolean licensed = operationMode == OperationMode.BASIC || operationMode == OperationMode.STANDARD || - operationMode == OperationMode.GOLD || operationMode == OperationMode.PLATINUM; - - return licensed && localStatus.active; - + // Should work on all active licenses + return localStatus.active; } - } diff --git a/plugin/src/main/java/org/elasticsearch/xpack/upgrade/Upgrade.java b/plugin/src/main/java/org/elasticsearch/xpack/upgrade/Upgrade.java index db6dfbe0fce..709f9efee48 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/upgrade/Upgrade.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/upgrade/Upgrade.java @@ -46,7 +46,7 @@ import java.util.function.Supplier; public class Upgrade implements ActionPlugin { - public static final Version UPGRADE_INTRODUCED = Version.V_5_5_0_UNRELEASED; // TODO: Probably will need to change this to 5.6.0 + public static final Version UPGRADE_INTRODUCED = Version.V_5_5_0; // TODO: Probably will need to change this to 5.6.0 private final Settings settings; private final List> upgradeCheckFactories; diff --git a/plugin/src/test/java/org/elasticsearch/xpack/upgrade/IndexUpgradeIntegTestCase.java b/plugin/src/test/java/org/elasticsearch/xpack/upgrade/IndexUpgradeIntegTestCase.java index fa9c2739cd2..98053e257d5 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/upgrade/IndexUpgradeIntegTestCase.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/upgrade/IndexUpgradeIntegTestCase.java @@ -60,11 +60,11 @@ public abstract class IndexUpgradeIntegTestCase extends AbstractLicensesIntegrat return nodePlugins(); } private static String randomValidLicenseType() { - return randomFrom("platinum", "gold", "standard", "basic"); + return randomFrom("trial", "platinum", "gold", "standard", "basic"); } private static String randomInvalidLicenseType() { - return randomFrom("missing", "trial"); + return "missing"; } public void disableLicensing() throws Exception {