Skip to content

Commit

Permalink
Refactor license checking (elastic#52118)
Browse files Browse the repository at this point in the history
Improve code resuse and readility. Add convenience checking method which 
covers most use cases without having to pass many boolean arguments.
  • Loading branch information
ywangd authored Feb 21, 2020
1 parent 0866031 commit 72cf242
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ && isProductionMode(settings, clusterService.localNode())) {
throw new IllegalStateException("Cannot install a [" + newLicense.operationMode() +
"] 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
&& newLicense.operationMode() != License.OperationMode.TRIAL) {
&& false == XPackLicenseState.isFipsAllowedForOperationMode(newLicense.operationMode())) {
throw new IllegalStateException("Cannot install a [" + newLicense.operationMode() +
"] license unless FIPS mode is disabled");
}
Expand Down
Loading

0 comments on commit 72cf242

Please sign in to comment.