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.
This commit is contained in:
parent
8229a57c53
commit
4c37335f1d
|
@ -73,7 +73,7 @@ public abstract class EnvironmentAwareCommand extends Command {
|
|||
protected Environment createEnv(final Terminal terminal, final Map<String, String> 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));
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue