From 4c37335f1d7bc00e0c11b857e9471bd63e949747 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Sun, 30 Jul 2017 09:49:55 +0900 Subject: [PATCH] Format CLI error message when es.path.conf not set This commit adds some formatting to the message displayed when es.path.conf is not set. --- .../java/org/elasticsearch/cli/EnvironmentAwareCommand.java | 2 +- .../org/elasticsearch/cli/EvilEnvironmentAwareCommandTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/cli/EnvironmentAwareCommand.java b/core/src/main/java/org/elasticsearch/cli/EnvironmentAwareCommand.java index e2f654a4c06..d9d19a56a2f 100644 --- a/core/src/main/java/org/elasticsearch/cli/EnvironmentAwareCommand.java +++ b/core/src/main/java/org/elasticsearch/cli/EnvironmentAwareCommand.java @@ -73,7 +73,7 @@ public abstract class EnvironmentAwareCommand extends Command { protected Environment createEnv(final Terminal terminal, final Map settings) throws UserException { final String esPathConf = System.getProperty("es.path.conf"); if (esPathConf == null) { - throw new UserException(ExitCodes.CONFIG, "the system property es.path.conf must be set"); + throw new UserException(ExitCodes.CONFIG, "the system property [es.path.conf] must be set"); } return InternalSettingsPreparer.prepareEnvironment(Settings.EMPTY, terminal, settings, getConfigPath(esPathConf)); } diff --git a/qa/evil-tests/src/test/java/org/elasticsearch/cli/EvilEnvironmentAwareCommandTests.java b/qa/evil-tests/src/test/java/org/elasticsearch/cli/EvilEnvironmentAwareCommandTests.java index cb6c254a8d3..d385342249a 100644 --- a/qa/evil-tests/src/test/java/org/elasticsearch/cli/EvilEnvironmentAwareCommandTests.java +++ b/qa/evil-tests/src/test/java/org/elasticsearch/cli/EvilEnvironmentAwareCommandTests.java @@ -54,7 +54,7 @@ public class EvilEnvironmentAwareCommandTests extends ESTestCase { final TestEnvironmentAwareCommand command = new TestEnvironmentAwareCommand("test"); final UserException e = expectThrows(UserException.class, () -> command.mainWithoutErrorHandling(new String[0], new MockTerminal())); - assertThat(e, hasToString(containsString("the system property es.path.conf must be set"))); + assertThat(e, hasToString(containsString("the system property [es.path.conf] must be set"))); } @SuppressForbidden(reason = "clears system property es.path.conf as part of test setup")