From dea702fcca05f8b1cc5b571b92dc0aea8c555a5f Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Fri, 25 May 2018 10:19:04 -0600 Subject: [PATCH] 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. --- .../elasticsearch/license/XPackInfoResponse.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackInfoResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackInfoResponse.java index 7c2886345470c..4d5c90ada4960 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackInfoResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackInfoResponse.java @@ -123,13 +123,15 @@ public License.Status getStatus() { @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 {