Do not serialize basic license exp in x-pack info (#30848)

This is a bug that was identified by the kibana team. Currently on a
get-license call we do not serialize the hard-coded expiration for basic
licenses. However, the kibana team calls the x-pack info route which
still does serialize the expiration date. This commit removes that
serialization in the rest response.
This commit is contained in:
Tim Brooks 2018-05-25 10:19:04 -06:00 committed by GitHub
parent e08c7c2df4
commit dcff63e69c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -123,13 +123,15 @@ public class XPackInfoResponse extends ActionResponse {
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
return builder.startObject()
.field("uid", uid)
.field("type", type)
.field("mode", mode)
.field("status", status.label())
.timeField("expiry_date_in_millis", "expiry_date", expiryDate)
.endObject();
builder.startObject()
.field("uid", uid)
.field("type", type)
.field("mode", mode)
.field("status", status.label());
if (expiryDate != LicenseService.BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS) {
builder.timeField("expiry_date_in_millis", "expiry_date", expiryDate);
}
return builder.endObject();
}
public void writeTo(StreamOutput out) throws IOException {