Skip to content

Commit

Permalink
Deprecation check for File Discovery plugin (#36190)
Browse files Browse the repository at this point in the history
Adds a deprecation warning that the file discovery plugin is no longer
needed and that the path it uses has changed.
  • Loading branch information
gwbrown authored Dec 7, 2018
1 parent 0a4f203 commit ea2d9b1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ private DeprecationChecks() {
static List<BiFunction<List<NodeInfo>, List<NodeStats>, DeprecationIssue>> NODE_SETTINGS_CHECKS =
Collections.unmodifiableList(Arrays.asList(
NodeDeprecationChecks::azureRepositoryChanges,
NodeDeprecationChecks::gcsRepositoryChanges
NodeDeprecationChecks::gcsRepositoryChanges,
NodeDeprecationChecks::fileDiscoveryPluginRemoved
));

static List<Function<IndexMetaData, DeprecationIssue>> INDEX_SETTINGS_CHECKS =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,20 @@ static DeprecationIssue gcsRepositoryChanges(List<NodeInfo> nodeInfos, List<Node
}
return null;
}

static DeprecationIssue fileDiscoveryPluginRemoved(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream()
.filter(nodeInfo ->
nodeInfo.getPlugins().getPluginInfos().stream()
.anyMatch(pluginInfo -> "discovery-file".equals(pluginInfo.getName()))
).map(nodeInfo -> nodeInfo.getNode().getName()).collect(Collectors.toList());
if (nodesFound.size() > 0) {
return new DeprecationIssue(DeprecationIssue.Level.WARNING,
"File-based discovery is no longer a plugin and uses a different path",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
"#_file_based_discovery_plugin",
"nodes with discovery-file installed: " + nodesFound);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,19 @@ public void testGCSPluginCheck() {
"nodes with repository-gcs installed: [node_check]");
assertSettingsAndIssue("foo", "bar", expected);
}

public void testFileDiscoveryPluginCheck() {
Version esVersion = VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, Version.CURRENT);
PluginInfo deprecatedPlugin = new PluginInfo(
"discovery-file", "dummy plugin description", "dummy_plugin_version", esVersion,
"javaVersion", "DummyPluginName", Collections.emptyList(), false);
pluginsAndModules = new PluginsAndModules(Collections.singletonList(deprecatedPlugin), Collections.emptyList());

DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.WARNING,
"File-based discovery is no longer a plugin and uses a different path",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
"#_file_based_discovery_plugin",
"nodes with discovery-file installed: [node_check]");
assertSettingsAndIssue("foo", "bar", expected);
}
}

0 comments on commit ea2d9b1

Please sign in to comment.