Use GString and closures to delay evaluating remote cluster URL until runtime

This commit is contained in:
Simon Willnauer 2016-11-24 15:44:06 +01:00
parent 276adbd990
commit 89a2384988
3 changed files with 2 additions and 15 deletions

View File

@ -96,15 +96,6 @@ class ClusterConfiguration {
return seedNode.transportUri()
}
/**
* A closure to call which returns a map of settings.
*
* This can be used to pass settings to a cluster that are not available at evaluation time ie.
* the address of a remote cluster etc.
*/
@Input
Closure dynamicSettings = { -> Collections.emptyMap() }
/**
* A closure to call before the cluster is considered ready. The closure is passed the node info,
* as well as a groovy AntBuilder, to enable running ant condition checks. The default wait

View File

@ -294,8 +294,6 @@ class ClusterFormationTasks {
if (unicastTransportUri != null) {
esConfig['discovery.zen.ping.unicast.hosts'] = "\"${unicastTransportUri}\""
}
Map dynamicSettings = node.config.dynamicSettings();
esConfig.putAll(dynamicSettings)
File configFile = new File(node.confDir, 'elasticsearch.yml')
logger.info("Configuring ${configFile}")
configFile.setText(esConfig.collect { key, value -> "${key}: ${value}" }.join('\n'), 'UTF-8')

View File

@ -35,10 +35,8 @@ task mixedClusterTest(type: RestIntegTestTask) {
dependsOn(remoteClusterTest)
cluster {
distribution = 'zip'
dynamicSettings = { ->
Collections.singletonMap("action.search.remote.my_remote_cluster",
"\"${remoteClusterTest.nodes.get(0).transportUri()}\"")
}
setting 'action.search.remote.my_remote_cluster', "\"${-> remoteClusterTest.nodes.get(0).transportUri()}\""
}
systemProperty 'tests.rest.suite', 'multi_cluster'
finalizedBy 'remoteClusterTest#stop'