Skip to content

Commit

Permalink
[Backport 2.x] Improve messaging on how to set initial admin password (
Browse files Browse the repository at this point in the history
…opensearch-project#3918)

Backport 21c086c from opensearch-project#3879.

Signed-off-by: Derek Ho <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 7efea06 commit 0da8452
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ void updateAdminPassword() {

// if ADMIN_PASSWORD is still an empty string, it implies no custom password was provided. We exit the setup.
if (Strings.isNullOrEmpty(ADMIN_PASSWORD)) {
System.out.println("No custom admin password found. Please provide a password.");
System.out.println(
String.format(
"No custom admin password found. Please provide a password via the environment variable %s.",
ConfigConstants.OPENSEARCH_INITIAL_ADMIN_PASSWORD
)
);
System.exit(-1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ public void testUpdateAdminPassword_noPasswordSupplied() {
System.setSecurityManager(null);
}

verifyStdOutContainsString("No custom admin password found. Please provide a password.");
verifyStdOutContainsString(
String.format(
"No custom admin password found. Please provide a password via the environment variable %s.",
ConfigConstants.OPENSEARCH_INITIAL_ADMIN_PASSWORD
)
);
}

@Test
Expand Down

0 comments on commit 0da8452

Please sign in to comment.