From 3baf6f3a7a0db5a5dd5ebf3922c574d0a106ddd9 Mon Sep 17 00:00:00 2001 From: Jay Modi Date: Wed, 24 Jan 2018 12:44:25 -0700 Subject: [PATCH] Remove production from the message about license installation without TLS (elastic/x-pack-elasticsearch#3666) This change simply changes the wording of the message that is returned to the user when installation of a license is attempted with security enabled and TLS disabled. The term "production" has been removed as it means something different to users. See elastic/x-pack-elasticsearch#2636 Original commit: elastic/x-pack-elasticsearch@9739c72d6674e58a270796b07c8d6dc15aab9373 --- .../main/java/org/elasticsearch/license/LicenseService.java | 4 ++-- .../elasticsearch/license/LicensesAcknowledgementTests.java | 2 +- .../license/LicenseServiceWithSecurityTests.java | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugin/core/src/main/java/org/elasticsearch/license/LicenseService.java b/plugin/core/src/main/java/org/elasticsearch/license/LicenseService.java index adbe0c6df10..d0d882b7bda 100644 --- a/plugin/core/src/main/java/org/elasticsearch/license/LicenseService.java +++ b/plugin/core/src/main/java/org/elasticsearch/license/LicenseService.java @@ -216,8 +216,8 @@ public class LicenseService extends AbstractLifecycleComponent implements Cluste && XPackSettings.TRANSPORT_SSL_ENABLED.get(settings) == false && "single-node".equals(DiscoveryModule.DISCOVERY_TYPE_SETTING.get(settings)) == false) { // security is on but TLS is not configured we gonna fail the entire request and throw an exception - throw new IllegalStateException("Can not upgrade to a production license unless TLS is configured or " + - "security is disabled"); + throw new IllegalStateException("Cannot install a [" + newLicense.operationMode() + + "] license unless TLS is configured or security is disabled"); // TODO we should really validate that all nodes have xpack installed and are consistently configured but this // should happen on a different level and not in this code } else { diff --git a/plugin/core/src/test/java/org/elasticsearch/license/LicensesAcknowledgementTests.java b/plugin/core/src/test/java/org/elasticsearch/license/LicensesAcknowledgementTests.java index eed19785b1b..211215da21c 100644 --- a/plugin/core/src/test/java/org/elasticsearch/license/LicensesAcknowledgementTests.java +++ b/plugin/core/src/test/java/org/elasticsearch/license/LicensesAcknowledgementTests.java @@ -48,7 +48,7 @@ public class LicensesAcknowledgementTests extends AbstractLicenseServiceTestCase // ensure acknowledgement message was part of the response IllegalStateException ise = expectThrows(IllegalStateException.class, () -> licenseService.registerLicense(putLicenseRequest, new AssertingLicensesUpdateResponse(false, LicensesStatus.VALID, true))); - assertEquals("Can not upgrade to a production license unless TLS is configured or security is disabled", ise.getMessage()); + assertEquals("Cannot install a [PLATINUM] license unless TLS is configured or security is disabled", ise.getMessage()); } public void testUpgradeToProductionWithoutTLSAndSecurityDisabled() throws Exception { diff --git a/plugin/security/src/test/java/org/elasticsearch/license/LicenseServiceWithSecurityTests.java b/plugin/security/src/test/java/org/elasticsearch/license/LicenseServiceWithSecurityTests.java index 230e29c6b80..42bfd2df1d5 100644 --- a/plugin/security/src/test/java/org/elasticsearch/license/LicenseServiceWithSecurityTests.java +++ b/plugin/security/src/test/java/org/elasticsearch/license/LicenseServiceWithSecurityTests.java @@ -11,7 +11,6 @@ import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.SecurityIntegTestCase; import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.xpack.security.LocalStateSecurity; -import org.elasticsearch.xpack.security.Security; import java.util.Arrays; import java.util.Collection; @@ -39,7 +38,7 @@ public class LicenseServiceWithSecurityTests extends SecurityIntegTestCase { License license = licensingClient.prepareGetLicense().get().license(); License prodLicense = TestUtils.generateSignedLicense("platinum", TimeValue.timeValueHours(24)); IllegalStateException ise = expectThrows(IllegalStateException.class, () -> licensingClient.preparePutLicense(prodLicense).get()); - assertEquals("Can not upgrade to a production license unless TLS is configured or security is disabled", ise.getMessage()); + assertEquals("Cannot install a [PLATINUM] license unless TLS is configured or security is disabled", ise.getMessage()); assertThat(licensingClient.prepareGetLicense().get().license(), equalTo(license)); }