Fix handling of the local flag on get licenses request

Original commit: elastic/x-pack-elasticsearch@50bb6dc9c3
This commit is contained in:
Igor Motov 2014-10-28 10:38:00 -04:00 committed by Areek Zillur
parent 3445af6d93
commit 82fa8badeb
3 changed files with 6 additions and 4 deletions

View File

@ -27,12 +27,12 @@ public class GetLicenseRequest extends MasterNodeReadOperationRequest<GetLicense
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readLocal(in, Version.V_1_0_0_RC2);
readLocal(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeLocal(out, Version.V_1_0_0_RC2);
writeLocal(out);
}
}

View File

@ -38,7 +38,7 @@ public class TransportPutLicenseAction extends TransportMasterNodeOperationActio
@Override
protected String executor() {
return ThreadPool.Names.SAME;
return ThreadPool.Names.MANAGEMENT;
}
@Override

View File

@ -59,7 +59,9 @@ public class RestGetLicenseAction extends BaseRestHandler {
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
final Map<String, String> overrideParams = ImmutableMap.of(ESLicenses.OMIT_SIGNATURE, "true");
final ToXContent.Params params = new ToXContent.DelegatingMapParams(overrideParams, request);
client.admin().cluster().execute(GetLicenseAction.INSTANCE, new GetLicenseRequest(), new RestBuilderListener<GetLicenseResponse>(channel) {
GetLicenseRequest getLicenseRequest = new GetLicenseRequest();
getLicenseRequest.local(request.paramAsBoolean("local", getLicenseRequest.local()));
client.admin().cluster().execute(GetLicenseAction.INSTANCE, getLicenseRequest, new RestBuilderListener<GetLicenseResponse>(channel) {
@Override
public RestResponse buildResponse(GetLicenseResponse response, XContentBuilder builder) throws Exception {
ESLicenses.toXContent(response.licenses(), builder, params);