-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
License removal leads back to a basic license #52407
Conversation
Pinging @elastic/es-security (:Security/License) |
@bytebilly FYI |
License selfGeneratedLicense = SelfGeneratedLicense.create(specBuilder, currentState.nodes()); | ||
LicensesMetaData newLicensesMetadata = new LicensesMetaData(selfGeneratedLicense, | ||
currentLicensesMetadata == null ? null : currentLicensesMetadata.getMostRecentTrialVersion()); | ||
mdBuilder.putCustom(LicensesMetaData.TYPE, newLicensesMetadata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we merge this code and the duplicate from StartBasicClusterTask
into a single generateNewBasicLicense()
method?
final StartBasicClusterTask startBasicClusterTask = | ||
new StartBasicClusterTask(logger, clusterService.getClusterName().value(), clock, | ||
new PostStartBasicRequest().acknowledge(true), null); | ||
return startBasicClusterTask.execute(currentState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels weird to me.
We run a task, that just creates another task and executes that, and it feels like that's just so we can change the response object.
Why not change this to something like:
public void removeLicense(final DeleteLicenseRequest request, final ActionListener<PostStartBasicResponse> listener) {
PostStartBasicRequest startBasicRequest = new PostStartBasicRequest().acknowledge(true);
startBasicLicense(startBasicRequest, listener);
}
and then have the Transport action translate the PostStartBasicResponse
into the AcknowledgedResponse
it needs to keep compatibilty with the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I'll update it with a small change: instead of delegating to startBasicLicense()
method, I'll keep the task submission part so that the context is not lost, i.e. clusterService.submitStateUpdateTask("delete license", new StartBasicClusterTask(...))
A new basic license will be generated when existing license is deleted. In addition, deleting an existing basic license is a no-op. Resolves: elastic#45022
backported:
|
A new basic license will be generated when existing license is deleted.
In addition, deleting an existing basic license is a no-op.
Resolves: #45022