Skip to content

Commit 12876e0

Browse files
committed
Merge branch 'main' of github.com:elastic/elasticsearch into esql-changepoint-processing-command
2 parents f00522a + a33708d commit 12876e0

File tree

314 files changed

+4207
-3164
lines changed

Some content is hidden

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

314 files changed

+4207
-3164
lines changed

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 {

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void testMissingPromptCreateWithoutPasswordWithoutPromptIfForced() throws
8383
public void testMissingNoCreate() throws Exception {
8484
terminal.addTextInput("n"); // explicit no
8585
execute("foo");
86-
assertNull(KeyStoreWrapper.load(env.configFile()));
86+
assertNull(KeyStoreWrapper.load(env.configDir()));
8787
}
8888

8989
public void testOverwritePromptDefault() throws Exception {
@@ -143,7 +143,7 @@ public void testForceNonExistent() throws Exception {
143143

144144
public void testPromptForValue() throws Exception {
145145
String password = "keystorepassword";
146-
KeyStoreWrapper.create().save(env.configFile(), password.toCharArray());
146+
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
147147
terminal.addSecretInput(password);
148148
terminal.addSecretInput("secret value");
149149
execute("foo");
@@ -152,7 +152,7 @@ public void testPromptForValue() throws Exception {
152152

153153
public void testPromptForMultipleValues() throws Exception {
154154
final String password = "keystorepassword";
155-
KeyStoreWrapper.create().save(env.configFile(), password.toCharArray());
155+
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
156156
terminal.addSecretInput(password);
157157
terminal.addSecretInput("bar1");
158158
terminal.addSecretInput("bar2");
@@ -165,7 +165,7 @@ public void testPromptForMultipleValues() throws Exception {
165165

166166
public void testStdinShort() throws Exception {
167167
String password = "keystorepassword";
168-
KeyStoreWrapper.create().save(env.configFile(), password.toCharArray());
168+
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
169169
terminal.addSecretInput(password);
170170
setInput("secret value 1");
171171
execute("-x", "foo");
@@ -174,7 +174,7 @@ public void testStdinShort() throws Exception {
174174

175175
public void testStdinLong() throws Exception {
176176
String password = "keystorepassword";
177-
KeyStoreWrapper.create().save(env.configFile(), password.toCharArray());
177+
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
178178
terminal.addSecretInput(password);
179179
setInput("secret value 2");
180180
execute("--stdin", "foo");
@@ -183,7 +183,7 @@ public void testStdinLong() throws Exception {
183183

184184
public void testStdinNoInput() throws Exception {
185185
String password = "keystorepassword";
186-
KeyStoreWrapper.create().save(env.configFile(), password.toCharArray());
186+
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
187187
terminal.addSecretInput(password);
188188
setInput("");
189189
execute("-x", "foo");
@@ -192,7 +192,7 @@ public void testStdinNoInput() throws Exception {
192192

193193
public void testStdinInputWithLineBreaks() throws Exception {
194194
String password = "keystorepassword";
195-
KeyStoreWrapper.create().save(env.configFile(), password.toCharArray());
195+
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
196196
terminal.addSecretInput(password);
197197
setInput("Typedthisandhitenter\n");
198198
execute("-x", "foo");
@@ -201,7 +201,7 @@ public void testStdinInputWithLineBreaks() throws Exception {
201201

202202
public void testStdinInputWithCarriageReturn() throws Exception {
203203
String password = "keystorepassword";
204-
KeyStoreWrapper.create().save(env.configFile(), password.toCharArray());
204+
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
205205
terminal.addSecretInput(password);
206206
setInput("Typedthisandhitenter\r");
207207
execute("-x", "foo");
@@ -210,7 +210,7 @@ public void testStdinInputWithCarriageReturn() throws Exception {
210210

211211
public void testStdinWithMultipleValues() throws Exception {
212212
final String password = "keystorepassword";
213-
KeyStoreWrapper.create().save(env.configFile(), password.toCharArray());
213+
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
214214
terminal.addSecretInput(password);
215215
setInput("bar1\nbar2\nbar3");
216216
execute(randomFrom("-x", "--stdin"), "foo1", "foo2", "foo3");
@@ -221,7 +221,7 @@ public void testStdinWithMultipleValues() throws Exception {
221221

222222
public void testAddUtf8String() throws Exception {
223223
String password = "keystorepassword";
224-
KeyStoreWrapper.create().save(env.configFile(), password.toCharArray());
224+
KeyStoreWrapper.create().save(env.configDir(), password.toCharArray());
225225
terminal.addSecretInput(password);
226226
final int stringSize = randomIntBetween(8, 16);
227227
try (CharArrayWriter secretChars = new CharArrayWriter(stringSize)) {

0 commit comments

Comments
 (0)