Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ private static ElasticsearchStatusException indexMetadataNonCompliantRemoteLicen
RemoteClusterLicenseChecker.buildErrorMessage(
"ccr",
licenseCheck.remoteClusterLicenseInfo(),
RemoteClusterLicenseChecker::isLicensePlatinumOrTrial));
RemoteClusterLicenseChecker::isLicensePlatinumPlusOrTrial));
return new ElasticsearchStatusException(message, RestStatus.BAD_REQUEST);
}

Expand All @@ -426,7 +426,7 @@ private static ElasticsearchStatusException clusterStateNonCompliantRemoteLicens
RemoteClusterLicenseChecker.buildErrorMessage(
"ccr",
licenseCheck.remoteClusterLicenseInfo(),
RemoteClusterLicenseChecker::isLicensePlatinumOrTrial));
RemoteClusterLicenseChecker::isLicensePlatinumPlusOrTrial));
return new ElasticsearchStatusException(message, RestStatus.BAD_REQUEST);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ public enum OperationMode {
BASIC((byte) 2),
STANDARD((byte) 3),
GOLD((byte) 4),
PLATINUM((byte) 5);
PLATINUM((byte) 5),
ENTERPRISE((byte) 6);

private final byte id;

Expand Down Expand Up @@ -208,8 +209,9 @@ public static OperationMode resolve(LicenseType type) {
case GOLD:
return GOLD;
case PLATINUM:
case ENTERPRISE: // TODO Add an explicit enterprise operating mode
return PLATINUM;
case ENTERPRISE:
return ENTERPRISE;
case TRIAL:
return TRIAL;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ && isProductionMode(settings, clusterService.localNode())) {
"] license unless TLS is configured or security is disabled");
} else if (XPackSettings.FIPS_MODE_ENABLED.get(settings)
&& newLicense.operationMode() != License.OperationMode.PLATINUM
&& newLicense.operationMode() != License.OperationMode.ENTERPRISE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer that we change this to either be < PLATINUM, or use methods on XPackLicenseState so that we don't have a bunch of code that assumes the set of licenses and their ordering.

&& newLicense.operationMode() != License.OperationMode.TRIAL) {
throw new IllegalStateException("Cannot install a [" + newLicense.operationMode() +
"] license unless FIPS mode is disabled");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ public RemoteClusterLicenseChecker(final Client client, final Predicate<License.
this.predicate = predicate;
}

public static boolean isLicensePlatinumOrTrial(final XPackInfoResponse.LicenseInfo licenseInfo) {
public static boolean isLicensePlatinumPlusOrTrial(final XPackInfoResponse.LicenseInfo licenseInfo) {
final License.OperationMode mode = License.OperationMode.parse(licenseInfo.getMode());
return mode == License.OperationMode.PLATINUM || mode == License.OperationMode.TRIAL;
return mode == License.OperationMode.PLATINUM || mode == License.OperationMode.ENTERPRISE || mode == License.OperationMode.TRIAL;
}

/**
Expand Down
Loading