Skip to content

Commit 72cf242

Browse files
authored
Refactor license checking (#52118)
Improve code resuse and readility. Add convenience checking method which covers most use cases without having to pass many boolean arguments.
1 parent 0866031 commit 72cf242

File tree

4 files changed

+132
-235
lines changed

4 files changed

+132
-235
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/license/LicenseService.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,7 @@ && isProductionMode(settings, clusterService.localNode())) {
255255
throw new IllegalStateException("Cannot install a [" + newLicense.operationMode() +
256256
"] license unless TLS is configured or security is disabled");
257257
} else if (XPackSettings.FIPS_MODE_ENABLED.get(settings)
258-
&& newLicense.operationMode() != License.OperationMode.PLATINUM
259-
&& newLicense.operationMode() != License.OperationMode.ENTERPRISE
260-
&& newLicense.operationMode() != License.OperationMode.TRIAL) {
258+
&& false == XPackLicenseState.isFipsAllowedForOperationMode(newLicense.operationMode())) {
261259
throw new IllegalStateException("Cannot install a [" + newLicense.operationMode() +
262260
"] license unless FIPS mode is disabled");
263261
}

0 commit comments

Comments
 (0)