Skip to content

Commit

Permalink
Add both cluster.initial_cluster_manager_nodes and cluster.initial_ma…
Browse files Browse the repository at this point in the history
…ster_nodes into an error message of BootstrapChecks

Signed-off-by: Tianli Feng <ftianli@amazon.com>
  • Loading branch information
Tianli Feng committed Mar 17, 2022
1 parent c967ad4 commit 2ee85da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static org.opensearch.cluster.coordination.ClusterBootstrapService.INITIAL_CLUSTER_MANAGER_NODES_SETTING;
import static org.opensearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING;
import static org.opensearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
import static org.opensearch.discovery.SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
Expand Down Expand Up @@ -773,10 +774,12 @@ public BootstrapCheckResult check(BootstrapContext context) {
return BootstrapCheckResult.failure(
String.format(
Locale.ROOT,
"the default discovery settings are unsuitable for production use; at least one of [%s] must be configured",
Stream.of(DISCOVERY_SEED_HOSTS_SETTING, DISCOVERY_SEED_PROVIDERS_SETTING, INITIAL_MASTER_NODES_SETTING)
// TODO: Remove ' / %s' from the error message after removing MASTER_ROLE, and update unit test.
"the default discovery settings are unsuitable for production use; at least one of [%s / %s] must be configured",
Stream.of(DISCOVERY_SEED_HOSTS_SETTING, DISCOVERY_SEED_PROVIDERS_SETTING, INITIAL_CLUSTER_MANAGER_NODES_SETTING)
.map(Setting::getKey)
.collect(Collectors.joining(", "))
.collect(Collectors.joining(", ")),
INITIAL_MASTER_NODES_SETTING.getKey()
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ public void testDiscoveryConfiguredCheck() throws NodeValidationException {
hasToString(
containsString(
"the default discovery settings are unsuitable for production use; at least one "
+ "of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured"
+ "of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_cluster_manager_nodes / cluster.initial_master_nodes] must be configured"
)
)
);
Expand Down

0 comments on commit 2ee85da

Please sign in to comment.