Skip to content

Commit

Permalink
[test] Create subdir in config dir if required (elastic#99218)
Browse files Browse the repository at this point in the history
This commit updates the local cluster factory so that extra config files
(see `LocalSpecBuilder.configFile`) can be placed into subdirectories of
the config dir. This is needed when creating files for the
`FileSettingsService` - these k8s managed files are required to be in an
`"operator/"` directory within the general configuration directory.
  • Loading branch information
tvernum authored and brianseeders committed Oct 30, 2023
1 parent 2b3a247 commit 25aabdb
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,18 @@ private void writeConfiguration() {
}

private void copyExtraConfigFiles() {
spec.getExtraConfigFiles().forEach((fileName, resource) -> resource.writeTo(configDir.resolve(fileName)));
spec.getExtraConfigFiles().forEach((fileName, resource) -> {
final Path target = configDir.resolve(fileName);
final Path directory = target.getParent();
if (Files.exists(directory) == false) {
try {
Files.createDirectories(directory);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
resource.writeTo(target);
});
}

private void createKeystore() {
Expand Down

0 comments on commit 25aabdb

Please sign in to comment.