mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 06:16:40 +00:00
Build: Fix extra config to create a file, not a directory for the destination file
Also added some checks to catch misconfiguration (dir or non existing file).
This commit is contained in:
parent
b30db5d676
commit
84d6cbd32a
@ -170,8 +170,17 @@ class ClusterFormationTasks {
|
|||||||
Copy copyConfig = project.tasks.create(name: name, type: Copy, dependsOn: setup)
|
Copy copyConfig = project.tasks.create(name: name, type: Copy, dependsOn: setup)
|
||||||
copyConfig.into(new File(node.homeDir, 'config')) // copy must always have a general dest dir, even though we don't use it
|
copyConfig.into(new File(node.homeDir, 'config')) // copy must always have a general dest dir, even though we don't use it
|
||||||
for (Map.Entry<String,Object> extraConfigFile : node.config.extraConfigFiles.entrySet()) {
|
for (Map.Entry<String,Object> extraConfigFile : node.config.extraConfigFiles.entrySet()) {
|
||||||
copyConfig.from(extraConfigFile.getValue())
|
File srcConfigFile = project.file(extraConfigFile.getValue())
|
||||||
.into(new File(node.homeDir, 'config/' + extraConfigFile.getKey()))
|
if (srcConfigFile.isDirectory()) {
|
||||||
|
throw new GradleException("Source for extraConfigFile must be a file: ${srcConfigFile}")
|
||||||
|
}
|
||||||
|
if (srcConfigFile.exists() == false) {
|
||||||
|
throw new GradleException("Source file for extraConfigFile does not exist: ${srcConfigFile}")
|
||||||
|
}
|
||||||
|
File destConfigFile = new File(node.homeDir, 'config/' + extraConfigFile.getKey())
|
||||||
|
copyConfig.from(srcConfigFile)
|
||||||
|
.into(destConfigFile.canonicalFile.parentFile)
|
||||||
|
.rename { destConfigFile.name }
|
||||||
}
|
}
|
||||||
copyConfig.doLast {
|
copyConfig.doLast {
|
||||||
// write elasticsearch.yml last, it cannot be overriden
|
// write elasticsearch.yml last, it cannot be overriden
|
||||||
|
Loading…
x
Reference in New Issue
Block a user