Skip to content

Commit e6276e8

Browse files
committed
Stop serialising licensed flag
1 parent 1d9d6db commit e6276e8

File tree

3 files changed

+7
-33
lines changed

3 files changed

+7
-33
lines changed

distribution/tools/plugin-cli/src/test/java/org/elasticsearch/plugins/ListPluginsCommandTests.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ public void testPluginWithVerbose() throws Exception {
152152
"Elasticsearch Version: " + Version.CURRENT.toString(),
153153
"Java Version: 1.8",
154154
"Native Controller: false",
155-
"Licensed: false",
156155
"Extended Plugins: []",
157156
" * Classname: org.fake"),
158157
terminal.getOutput());
@@ -173,7 +172,6 @@ public void testPluginWithNativeController() throws Exception {
173172
"Elasticsearch Version: " + Version.CURRENT.toString(),
174173
"Java Version: 1.8",
175174
"Native Controller: true",
176-
"Licensed: false",
177175
"Extended Plugins: []",
178176
" * Classname: org.fake"),
179177
terminal.getOutput());
@@ -195,7 +193,6 @@ public void testPluginWithVerboseMultiplePlugins() throws Exception {
195193
"Elasticsearch Version: " + Version.CURRENT.toString(),
196194
"Java Version: 1.8",
197195
"Native Controller: false",
198-
"Licensed: false",
199196
"Extended Plugins: []",
200197
" * Classname: org.fake",
201198
"fake_plugin2",
@@ -206,7 +203,6 @@ public void testPluginWithVerboseMultiplePlugins() throws Exception {
206203
"Elasticsearch Version: " + Version.CURRENT.toString(),
207204
"Java Version: 1.8",
208205
"Native Controller: false",
209-
"Licensed: false",
210206
"Extended Plugins: []",
211207
" * Classname: org.fake2"),
212208
terminal.getOutput());

server/src/main/java/org/elasticsearch/plugins/PluginInfo.java

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public class PluginInfo implements Writeable, ToXContentObject {
5050
public static final String ES_PLUGIN_PROPERTIES = "plugin-descriptor.properties";
5151
public static final String ES_PLUGIN_POLICY = "plugin-security.policy";
5252

53+
private static final Version LICENSED_PLUGINS_SUPPORT = Version.V_6_8_14;
54+
5355
private final String name;
5456
private final String description;
5557
private final String version;
@@ -123,11 +125,8 @@ public PluginInfo(final StreamInput in) throws IOException {
123125
*/
124126
in.readBoolean();
125127
}
126-
if (isLicensedPluginsSupported(in.getVersion())) {
127-
isLicensed = in.readBoolean();
128-
} else {
129-
isLicensed = false;
130-
}
128+
// We don't serialise `isLicensed` in 6.8
129+
isLicensed = false;
131130
}
132131

133132
@Override
@@ -153,31 +152,13 @@ public void writeTo(final StreamOutput out) throws IOException {
153152
*/
154153
out.writeBoolean(false);
155154
}
156-
if (isLicensedPluginsSupported(out.getVersion())) {
157-
out.writeBoolean(isLicensed);
158-
}
155+
// We don't serialise `isLicensed` in 6.8
159156
}
160157

161158
// We have to create our own Version objects for 7.x because they aren't defined in the Version class.
162159
private static final Version V_7_0_0 = Version.fromId(7_00_00_99);
163160
private static final Version V_7_11_0 = Version.fromId(7_11_00_99);
164161

165-
/**
166-
* Checks whether licensed plugins are supported in the supplied version. Licensed plugins were
167-
* introduced late in the 6.8 and 7.x lifecycle, so it is not possible to simply check whether
168-
* the supplied version is higher than a specific version. Rather, the version could fall in
169-
* one of two possible ranges.
170-
* @param version the version to check
171-
* @return whether licensed plugins are supported in the version
172-
*/
173-
private static boolean isLicensedPluginsSupported(Version version) {
174-
if (version.onOrAfter(Version.V_6_8_14) && version.before(V_7_0_0)) {
175-
return true;
176-
}
177-
178-
return version.onOrAfter(V_7_11_0);
179-
}
180-
181162
/**
182163
* Reads the plugin descriptor file.
183164
*
@@ -246,7 +227,7 @@ public static PluginInfo readFromProperties(final Path path) throws IOException
246227
}
247228

248229
boolean isLicensed = false;
249-
if (isLicensedPluginsSupported(esVersion)) {
230+
if (esVersion.onOrAfter(LICENSED_PLUGINS_SUPPORT)) {
250231
isLicensed = parseBooleanValue(name, "licensed", propsMap.remove("licensed"));
251232
}
252233

@@ -364,7 +345,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
364345
builder.field("classname", classname);
365346
builder.field("extended_plugins", extendedPlugins);
366347
builder.field("has_native_controller", hasNativeController);
367-
builder.field("licensed", isLicensed);
368348
}
369349
builder.endObject();
370350

@@ -404,7 +384,6 @@ public String toString(String prefix) {
404384
.append(prefix).append("Elasticsearch Version: ").append(elasticsearchVersion).append("\n")
405385
.append(prefix).append("Java Version: ").append(javaVersion).append("\n")
406386
.append(prefix).append("Native Controller: ").append(hasNativeController).append("\n")
407-
.append(prefix).append("Licensed: ").append(isLicensed).append("\n")
408387
.append(prefix).append("Extended Plugins: ").append(extendedPlugins).append("\n")
409388
.append(prefix).append(" * Classname: ").append(classname);
410389
return information.toString();

x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/collector/cluster/ClusterStatsMonitoringDocTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,7 @@ public void testToXContent() throws IOException {
502502
+ "\"description\":\"_plugin_desc\","
503503
+ "\"classname\":\"_plugin_class\","
504504
+ "\"extended_plugins\":[],"
505-
+ "\"has_native_controller\":false,"
506-
+ "\"licensed\":false"
505+
+ "\"has_native_controller\":false"
507506
+ "}"
508507
+ "],"
509508
+ "\"network_types\":{"

0 commit comments

Comments
 (0)