Skip to content

Commit 3aa29f5

Browse files
committed
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.
1 parent c4c69ce commit 3aa29f5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackInfoResponse.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,15 @@ public License.Status getStatus() {
123123

124124
@Override
125125
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
126-
return builder.startObject()
127-
.field("uid", uid)
128-
.field("type", type)
129-
.field("mode", mode)
130-
.field("status", status.label())
131-
.timeField("expiry_date_in_millis", "expiry_date", expiryDate)
132-
.endObject();
126+
builder.startObject()
127+
.field("uid", uid)
128+
.field("type", type)
129+
.field("mode", mode)
130+
.field("status", status.label());
131+
if (expiryDate != LicenseService.BASIC_SELF_GENERATED_LICENSE_EXPIRATION_MILLIS) {
132+
builder.timeField("expiry_date_in_millis", "expiry_date", expiryDate);
133+
}
134+
return builder.endObject();
133135
}
134136

135137
public void writeTo(StreamOutput out) throws IOException {

0 commit comments

Comments
 (0)