Skip to content

Commit

Permalink
Remove checks for legacy .yaml and .json config files.
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Handalian <handalm@amazon.com>
  • Loading branch information
mch2 committed May 27, 2021
1 parent c62884a commit 897e9d8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ public static Environment prepareEnvironment(Settings input, Map<String, String>
initializeSettings(output, input, properties);
Environment environment = new Environment(output.build(), configPath);

if (Files.exists(environment.configFile().resolve("opensearch.yaml"))) {
throw new SettingsException("opensearch.yaml was deprecated in 5.5.0 and must be renamed to opensearch.yml");
}

if (Files.exists(environment.configFile().resolve("opensearch.json"))) {
throw new SettingsException("opensearch.json was deprecated in 5.5.0 and must be converted to opensearch.yml");
}

output = Settings.builder(); // start with a fresh output
Path path = environment.configFile().resolve("opensearch.yml");
if (Files.exists(path)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,28 +114,6 @@ public void testGarbageIsNotSwallowed() throws IOException {
}
}

@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/358")
public void testYamlNotAllowed() throws IOException {
InputStream yaml = getClass().getResourceAsStream("/config/opensearch.yml");
Path config = homeDir.resolve("config");
Files.createDirectory(config);
Files.copy(yaml, config.resolve("opensearch.yaml"));
SettingsException e = expectThrows(SettingsException.class, () -> InternalSettingsPreparer.prepareEnvironment(
Settings.builder().put(baseEnvSettings).build(), emptyMap(), null, DEFAULT_NODE_NAME_SHOULDNT_BE_CALLED));
assertEquals("opensearch.yaml was deprecated in 5.5.0 and must be renamed to opensearch.yml", e.getMessage());
}

@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/358")
public void testJsonNotAllowed() throws IOException {
InputStream yaml = getClass().getResourceAsStream("/config/opensearch.json");
Path config = homeDir.resolve("config");
Files.createDirectory(config);
Files.copy(yaml, config.resolve("opensearch.json"));
SettingsException e = expectThrows(SettingsException.class, () -> InternalSettingsPreparer.prepareEnvironment(
Settings.builder().put(baseEnvSettings).build(), emptyMap(), null, DEFAULT_NODE_NAME_SHOULDNT_BE_CALLED));
assertEquals("opensearch.json was deprecated in 5.5.0 and must be converted to opensearch.yml", e.getMessage());
}

public void testSecureSettings() {
MockSecureSettings secureSettings = new MockSecureSettings();
secureSettings.setString("foo", "secret");
Expand Down

0 comments on commit 897e9d8

Please sign in to comment.