You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fail command-line client's auto-URL detection with helpful message (elastic#40151)
The setup-passwords tool gives cryptic messages in case where custom discovery providers are
used (see elastic#33580). As the URL auto-detection logic should be seen as best effort, this commit
improves the exception message to make it clearer what needs to be done to fix the issue.
Relates elastic#33580
Copy file name to clipboardExpand all lines: x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/esnative/tool/CommandLineHttpClient.java
+4-5Lines changed: 4 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,6 @@
27
27
importjava.io.IOException;
28
28
importjava.io.InputStream;
29
29
importjava.io.OutputStream;
30
-
importjava.io.UncheckedIOException;
31
30
importjava.net.HttpURLConnection;
32
31
importjava.net.InetAddress;
33
32
importjava.net.URL;
@@ -154,13 +153,13 @@ String getDefaultURL() {
154
153
// this sucks but a port can be specified with a value of 0, we'll never be able to connect to it so just default to
155
154
// what we know
156
155
if (port <= 0) {
157
-
thrownewIllegalStateException("unable to determine http port from settings, please use the -u option to provide the" +
158
-
" url");
156
+
thrownewIllegalStateException("unable to determine http port from settings");
Copy file name to clipboardExpand all lines: x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/esnative/tool/CommandLineHttpClientTests.java
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,8 @@
27
27
importjava.nio.charset.StandardCharsets;
28
28
importjava.nio.file.Path;
29
29
30
+
importstaticorg.hamcrest.Matchers.containsString;
31
+
30
32
/**
31
33
* This class tests {@link CommandLineHttpClient} For extensive tests related to
32
34
* ssl settings can be found {@link SSLConfigurationSettingsTests}
@@ -63,6 +65,15 @@ public void testCommandLineHttpClientCanExecuteAndReturnCorrectResultUsingSSLSet
63
65
assertEquals("Http response body does not match", "complete", httpResponse.getResponseBody().get("test"));
0 commit comments