Tribe node: pass path.conf to inner tribe clients

If we don't do this, and some path.conf is set when starting the tribe node, that path.conf will be ignored and the inner tribe clients will try to read elsewhere, where they most likely don't have permissions to read from.

Closes #16253
Closes #16258
This commit is contained in:
javanna 2016-01-27 12:35:45 +01:00 committed by Luca Cavanna
parent 3bdb54e529
commit 533af17068
2 changed files with 6 additions and 3 deletions

View File

@ -135,6 +135,9 @@ public class TribeService extends AbstractLifecycleComponent<TribeService> {
Settings.Builder sb = Settings.builder().put(entry.getValue()); Settings.Builder sb = Settings.builder().put(entry.getValue());
sb.put("name", settings.get("name") + "/" + entry.getKey()); sb.put("name", settings.get("name") + "/" + entry.getKey());
sb.put(Environment.PATH_HOME_SETTING.getKey(), Environment.PATH_HOME_SETTING.get(settings)); // pass through ES home dir sb.put(Environment.PATH_HOME_SETTING.getKey(), Environment.PATH_HOME_SETTING.get(settings)); // pass through ES home dir
if (Environment.PATH_CONF_SETTING.exists(settings)) {
sb.put(Environment.PATH_CONF_SETTING.getKey(), Environment.PATH_CONF_SETTING.get(settings));
}
sb.put(TRIBE_NAME, entry.getKey()); sb.put(TRIBE_NAME, entry.getKey());
if (sb.get("http.enabled") == null) { if (sb.get("http.enabled") == null) {
sb.put("http.enabled", false); sb.put("http.enabled", false);

View File

@ -91,7 +91,7 @@ public class TribeUnitTests extends ESTestCase {
System.setProperty("es.tribe.t2.discovery.id.seed", Long.toString(random().nextLong())); System.setProperty("es.tribe.t2.discovery.id.seed", Long.toString(random().nextLong()));
try { try {
assertTribeNodeSuccesfullyCreated(Settings.EMPTY); assertTribeNodeSuccessfullyCreated(Settings.EMPTY);
} finally { } finally {
System.clearProperty("es.cluster.name"); System.clearProperty("es.cluster.name");
System.clearProperty("es.tribe.t1.cluster.name"); System.clearProperty("es.tribe.t1.cluster.name");
@ -108,10 +108,10 @@ public class TribeUnitTests extends ESTestCase {
.put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING, true) .put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING, true)
.put(Environment.PATH_CONF_SETTING.getKey(), pathConf) .put(Environment.PATH_CONF_SETTING.getKey(), pathConf)
.build(); .build();
assertTribeNodeSuccesfullyCreated(settings); assertTribeNodeSuccessfullyCreated(settings);
} }
private static void assertTribeNodeSuccesfullyCreated(Settings extraSettings) throws Exception { private static void assertTribeNodeSuccessfullyCreated(Settings extraSettings) throws Exception {
//tribe node doesn't need the node.mode setting, as it's forced local internally anyways. The tribe clients do need it to make sure //tribe node doesn't need the node.mode setting, as it's forced local internally anyways. The tribe clients do need it to make sure
//they can find their corresponding tribes using the proper transport //they can find their corresponding tribes using the proper transport
Settings settings = Settings.builder().put("http.enabled", false).put("node.name", "tribe_node") Settings settings = Settings.builder().put("http.enabled", false).put("node.name", "tribe_node")