[Logstash] Change config management license to Gold (elastic/x-pack-elasticsearch#1843)

* [Logstash] Change management license to Gold

Previously the license type for LS config management was `BASIC`. In order to use the security features in Standard/Gold, we had to bump Logstash as well to Gold license.

relates elastic/x-pack-elasticsearch#1841

Original commit: elastic/x-pack-elasticsearch@29194b2417
This commit is contained in:
Suyog Rao 2017-06-27 14:21:00 -07:00 committed by GitHub
parent ad9797393a
commit e8472908c1
2 changed files with 33 additions and 10 deletions

View File

@ -176,9 +176,9 @@ public class XPackLicenseState {
private static String[] logstashAcknowledgementMessages(OperationMode currentMode, OperationMode newMode) { private static String[] logstashAcknowledgementMessages(OperationMode currentMode, OperationMode newMode) {
switch (newMode) { switch (newMode) {
case TRIAL:
switch (currentMode) {
case BASIC: case BASIC:
switch (currentMode) {
case TRIAL:
case STANDARD: case STANDARD:
case GOLD: case GOLD:
case PLATINUM: case PLATINUM:
@ -429,11 +429,25 @@ public class XPackLicenseState {
} }
/** /**
* Logstash is always allowed as long as there is an active license * Logstash is allowed as long as there is an active license of type TRIAL, STANDARD, GOLD or PLATINUM
* @return {@code true} as long as there is a valid license * @return {@code true} as long as there is a valid license
*/ */
public boolean isLogstashAllowed() { public boolean isLogstashAllowed() {
return status.active; Status localStatus = status;
if (localStatus.active == false) {
return false;
}
switch (localStatus.mode) {
case TRIAL:
case GOLD:
case PLATINUM:
case STANDARD:
return true;
default:
return false;
}
} }
/** /**

View File

@ -292,13 +292,22 @@ public class XPackLicenseStateTests extends ESTestCase {
assertAllowed(PLATINUM, false, XPackLicenseState::isMachineLearningAllowed, false); assertAllowed(PLATINUM, false, XPackLicenseState::isMachineLearningAllowed, false);
} }
public void testLogstashAllowed() { public void testLogstashPlatinumGoldTrialStandard() throws Exception {
assertAllowed(randomMode(), true, XPackLicenseState::isLogstashAllowed, true); assertAllowed(TRIAL, true, XPackLicenseState::isLogstashAllowed, true);
assertAllowed(randomMode(), false, XPackLicenseState::isLogstashAllowed, false); assertAllowed(GOLD, true, XPackLicenseState::isLogstashAllowed, true);
assertAllowed(PLATINUM, true, XPackLicenseState::isLogstashAllowed, true);
assertAllowed(STANDARD, true, XPackLicenseState::isLogstashAllowed, true);
} }
public void testLogstashAckNotBasicToTrial() { public void testLogstashBasicLicense() throws Exception {
OperationMode from = randomFrom(STANDARD, BASIC, GOLD, PLATINUM); assertAllowed(BASIC, true, XPackLicenseState::isLogstashAllowed, false);
assertAckMesssages(Logstash.NAME, from, TRIAL, 1); }
public void testLogstashInactive() {
assertAllowed(BASIC, false, XPackLicenseState::isLogstashAllowed, false);
assertAllowed(TRIAL, false, XPackLicenseState::isLogstashAllowed, false);
assertAllowed(GOLD, false, XPackLicenseState::isLogstashAllowed, false);
assertAllowed(PLATINUM, false, XPackLicenseState::isLogstashAllowed, false);
assertAllowed(STANDARD, false, XPackLicenseState::isLogstashAllowed, false);
} }
} }