Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation check for http.enabled setting #36394

Merged
merged 3 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ private DeprecationChecks() {

static List<BiFunction<List<NodeInfo>, List<NodeStats>, DeprecationIssue>> NODE_SETTINGS_CHECKS =
Collections.unmodifiableList(Arrays.asList(
NodeDeprecationChecks::httpEnabledSettingRemoved,
NodeDeprecationChecks::tribeNodeCheck,
NodeDeprecationChecks::azureRepositoryChanges,
NodeDeprecationChecks::gcsRepositoryChanges,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;

import java.util.List;
Expand All @@ -18,6 +19,21 @@
*/
public class NodeDeprecationChecks {

static DeprecationIssue httpEnabledSettingRemoved(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream()
.filter(nodeInfo -> nodeInfo.getSettings().hasValue(NetworkModule.HTTP_ENABLED.getKey()))
.map(nodeInfo -> nodeInfo.getNode().getName())
.collect(Collectors.toList());
if (nodesFound.size() > 0) {
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"HTTP Enabled setting removed",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
"#remove-http-enabled",
"nodes with http.enabled set: " + nodesFound);
}
return null;
}

static DeprecationIssue tribeNodeCheck(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
List<String> nodesFound = nodeInfos.stream()
.filter(nodeInfo -> nodeInfo.getSettings().getByPrefix("tribe.").isEmpty() == false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ null, null, null, null, new FsInfo(0L, null, paths), null, null, null,
assertEquals(singletonList(expected), issues);
}

public void testHttpEnabledCheck() {
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
"HTTP Enabled setting removed",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
"#remove-http-enabled",
"nodes with http.enabled set: [node_check]");
assertSettingsAndIssue("http.enabled", Boolean.toString(randomBoolean()), expected);
}

public void testTribeNodeCheck() {
String tribeSetting = "tribe." + randomAlphaOfLengthBetween(1, 20) + ".cluster.name";
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
Expand Down