Skip to content

Commit 3cacaf2

Browse files
authored
Merge branch '9.0' into backport/9.0/pr-121747
2 parents 2c11c74 + cbcdd0a commit 3cacaf2

File tree

281 files changed

+3405
-2327
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+3405
-2327
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/ThirdPartyAuditTask.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
import static org.gradle.api.JavaVersion.VERSION_21;
6161
import static org.gradle.api.JavaVersion.VERSION_22;
6262
import static org.gradle.api.JavaVersion.VERSION_23;
63+
import static org.gradle.api.JavaVersion.VERSION_24;
6364

6465
@CacheableTask
6566
public abstract class ThirdPartyAuditTask extends DefaultTask {
@@ -341,8 +342,12 @@ private String runForbiddenAPIsCli() throws IOException {
341342
spec.setExecutable(javaHome.get() + "/bin/java");
342343
}
343344
spec.classpath(getForbiddenAPIsClasspath(), getThirdPartyClasspath());
344-
// Enable explicitly for each release as appropriate. Just JDK 20/21/22/23 for now, and just the vector module.
345-
if (isJavaVersion(VERSION_20) || isJavaVersion(VERSION_21) || isJavaVersion(VERSION_22) || isJavaVersion(VERSION_23)) {
345+
// Enable explicitly for each release as appropriate. Just JDK 20/21/22/23/24 for now, and just the vector module.
346+
if (isJavaVersion(VERSION_20)
347+
|| isJavaVersion(VERSION_21)
348+
|| isJavaVersion(VERSION_22)
349+
|| isJavaVersion(VERSION_23)
350+
|| isJavaVersion(VERSION_24)) {
346351
spec.jvmArgs("--add-modules", "jdk.incubator.vector");
347352
}
348353
spec.jvmArgs("-Xmx1g");

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/AddFileKeyStoreCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected void executeCommand(Terminal terminal, OptionSet options, Environment
7474
keyStore.setFile(setting, Files.readAllBytes(file));
7575
}
7676

77-
keyStore.save(env.configFile(), getKeyStorePassword().getChars());
77+
keyStore.save(env.configDir(), getKeyStorePassword().getChars());
7878
}
7979

8080
@SuppressForbidden(reason = "file arg for cli")

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/AddStringKeyStoreCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected void executeCommand(Terminal terminal, OptionSet options, Environment
100100
}
101101
}
102102

103-
keyStore.save(env.configFile(), getKeyStorePassword().getChars());
103+
keyStore.save(env.configDir(), getKeyStorePassword().getChars());
104104
}
105105

106106
}

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/BaseKeyStoreCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ public BaseKeyStoreCommand(String description, boolean keyStoreMustExist) {
3939
@Override
4040
public final void execute(Terminal terminal, OptionSet options, Environment env, ProcessInfo processInfo) throws Exception {
4141
try {
42-
final Path configFile = env.configFile();
42+
final Path configFile = env.configDir();
4343
keyStore = KeyStoreWrapper.load(configFile);
4444
if (keyStore == null) {
4545
if (keyStoreMustExist) {
4646
throw new UserException(
4747
ExitCodes.DATA_ERROR,
4848
"Elasticsearch keystore not found at ["
49-
+ KeyStoreWrapper.keystorePath(env.configFile())
49+
+ KeyStoreWrapper.keystorePath(env.configDir())
5050
+ "]. Use 'create' command to create one."
5151
);
5252
} else if (options.has(forceOption) == false) {

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/ChangeKeyStorePasswordCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ChangeKeyStorePasswordCommand extends BaseKeyStoreCommand {
3131
protected void executeCommand(Terminal terminal, OptionSet options, Environment env) throws Exception {
3232
try (SecureString newPassword = readPassword(terminal, true)) {
3333
final KeyStoreWrapper keyStore = getKeyStore();
34-
keyStore.save(env.configFile(), newPassword.getChars());
34+
keyStore.save(env.configDir(), newPassword.getChars());
3535
terminal.println("Elasticsearch keystore password changed successfully.");
3636
} catch (SecurityException e) {
3737
throw new UserException(ExitCodes.DATA_ERROR, e.getMessage());

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/CreateKeyStoreCommand.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ class CreateKeyStoreCommand extends KeyStoreAwareCommand {
4040
@Override
4141
public void execute(Terminal terminal, OptionSet options, Environment env, ProcessInfo processInfo) throws Exception {
4242
try (SecureString password = options.has(passwordOption) ? readPassword(terminal, true) : new SecureString(new char[0])) {
43-
Path keystoreFile = KeyStoreWrapper.keystorePath(env.configFile());
43+
Path keystoreFile = KeyStoreWrapper.keystorePath(env.configDir());
4444
if (Files.exists(keystoreFile)) {
4545
if (terminal.promptYesNo("An elasticsearch keystore already exists. Overwrite?", false) == false) {
4646
terminal.println("Exiting without creating keystore.");
4747
return;
4848
}
4949
}
5050
KeyStoreWrapper keystore = KeyStoreWrapper.create();
51-
keystore.save(env.configFile(), password.getChars());
52-
terminal.println("Created elasticsearch keystore in " + KeyStoreWrapper.keystorePath(env.configFile()));
51+
keystore.save(env.configDir(), password.getChars());
52+
terminal.println("Created elasticsearch keystore in " + KeyStoreWrapper.keystorePath(env.configDir()));
5353
} catch (SecurityException e) {
5454
throw new UserException(ExitCodes.IO_ERROR, "Error creating the elasticsearch keystore.");
5555
}

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/HasPasswordKeyStoreCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class HasPasswordKeyStoreCommand extends KeyStoreAwareCommand {
3232

3333
@Override
3434
public void execute(Terminal terminal, OptionSet options, Environment env, ProcessInfo processInfo) throws Exception {
35-
final Path configFile = env.configFile();
35+
final Path configFile = env.configDir();
3636
final KeyStoreWrapper keyStore = KeyStoreWrapper.load(configFile);
3737

3838
// We handle error printing here so we can respect the "--silent" flag

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/RemoveSettingKeyStoreCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ protected void executeCommand(Terminal terminal, OptionSet options, Environment
4545
}
4646
keyStore.remove(setting);
4747
}
48-
keyStore.save(env.configFile(), getKeyStorePassword().getChars());
48+
keyStore.save(env.configDir(), getKeyStorePassword().getChars());
4949
}
5050
}

distribution/tools/keystore-cli/src/main/java/org/elasticsearch/cli/keystore/UpgradeKeyStoreCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class UpgradeKeyStoreCommand extends BaseKeyStoreCommand {
2626

2727
@Override
2828
protected void executeCommand(final Terminal terminal, final OptionSet options, final Environment env) throws Exception {
29-
KeyStoreWrapper.upgrade(getKeyStore(), env.configFile(), getKeyStorePassword().getChars());
29+
KeyStoreWrapper.upgrade(getKeyStore(), env.configDir(), getKeyStorePassword().getChars());
3030
}
3131

3232
}

distribution/tools/keystore-cli/src/test/java/org/elasticsearch/cli/keystore/AddFileKeyStoreCommandTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ private Path createRandomFile() throws IOException {
4646
for (int i = 0; i < length; ++i) {
4747
bytes[i] = randomByte();
4848
}
49-
Path file = env.configFile().resolve(randomAlphaOfLength(16));
49+
Path file = env.configDir().resolve(randomAlphaOfLength(16));
5050
Files.write(file, bytes);
5151
return file;
5252
}
5353

5454
private void addFile(KeyStoreWrapper keystore, String setting, Path file, String password) throws Exception {
5555
keystore.setFile(setting, Files.readAllBytes(file));
56-
keystore.save(env.configFile(), password.toCharArray());
56+
keystore.save(env.configDir(), password.toCharArray());
5757
}
5858

5959
public void testMissingCreateWithEmptyPasswordWhenPrompted() throws Exception {
@@ -77,7 +77,7 @@ public void testMissingNoCreate() throws Exception {
7777
terminal.addSecretInput(randomFrom("", "keystorepassword"));
7878
terminal.addTextInput("n"); // explicit no
7979
execute("foo");
80-
assertNull(KeyStoreWrapper.load(env.configFile()));
80+
assertNull(KeyStoreWrapper.load(env.configDir()));
8181
}
8282

8383
public void testOverwritePromptDefault() throws Exception {

0 commit comments

Comments
 (0)